Reputation: 27222
I am looking for an autocomplete ( or autosuggest) that is good for a search field like this:
<%= form_tag search_path, :method => :get do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
<% end %>
I try to use Crowdint rails3 jquery autocomplete but it does not work because of the params[:search]
inside of the search text_field_tag
.
What are my other options for autocomplete?
Upvotes: 1
Views: 849
Reputation: 8954
Theres an autocomplete in the jQuery ui library => http://jqueryui.com/
The autocomplete provided by jQuery UI is just a basic autocomplete like you know from sites like google.
You can also use a library which finds on jQuery like token inputs => http://loopj.com/jquery-tokeninput/ it matters which kind of autocomplete you want. Token Inputs is for selecting specific content which has a name and an id. The autocomplete provided by jQuery ui also needs a datasource but its more flexible and doesn't force you to select one of the existing entries.
Upvotes: 1
Reputation: 901
There is a great screencast by Ryan Bates on autocomplete fields.
http://railscasts.com/episodes/102-auto-complete-association-revised
Upvotes: 0