I’ve got this code working in a separate view, but with inside of a form_for
<%= text_field :search_tags, :id => 'search_tags', 'data-autocomplete' => "lame sauce" %>
What I’m trying to do is create a simple form for form submission with autocomplete. It works great in the other location, but for some reason, as soon as I take this text_field out of form_for it generates this HTML:
<input id="search_tags_{:id=>"search_tags", "data-autocomplete"=>"lame sauce"}" name="search_tags[{:id=>"search_tags", "data-autocomplete"=>"lame sauce"}]" size="30" type="text">
It’s all garbled and ugly 🙁
Now, because this is a simple form I’m submitting I was just using form_tag, I just need it to go to a specific controller and action… that’s it.
Anyway, I’ve read through the text_field_tag and text_field docs, and it seems that neither does quite what i’d like it to do. What is a good solution to this problem? Or is there some way of using text_field or text_field_tag, that I’m not aware of?
Many thanks!
If I understand, is only a problem in the way you used the text_field, try this: