Twitter Twitter Bootstrap autofill-related boot text field name

I am using typeahead js extension from twitter bootstrap for autocomplete field. I have a subtle problem with this. I have a text box like:

<%= text_field_tag :search, params[:search], :data => { :provide => 'typeahead', :source => ...} %>

The problem is that I have to specify name = 'search' (with: search) in order to be able to capture the value of the text input search. However, if I do this, the browser will automatically create an autocomplete history for entries that I have already tried in my text box.

If I delete: search and replace with '', the browser will not be able to save the history, because there is no name attribute in the text box. However, in this way, I cannot get the entered value myself.

How can I get around this?

+5
source share
1 answer

When I use autocomplete from jquery-ui, it sets the autocomplete = "off" attribute in the input tag, so you can try turning this option on: autocomplete => "off". Entries from the history are not displayed in the field, only what was transferred to autocomplete.

If this does not work, try jquery-ui autocomplete instead. It definitely works.

+7
source

All Articles