Reputation: 6768
<%= text_field_tag :barcode, params[:barcode] %>
generates
<input id="barcode" name="barcode" type="text"></input>
but I need
<input type="text" name="barcode" id="autocomplete"></input>
But in the documentation I did not find a way how to change the ID attribute.
I need to use a text_field_tag because it fills the textbox with params if submit fails.
Upvotes: 11
Views: 24544
Reputation: 51
Try this:
<%= text_field_tag "name_text","value_text", :class => "txBox", :size=>15 %>
HTML:
<input type="text" size="15" name="name_text" id="name_text" values="" class="txBox">
Upvotes: 1
Reputation: 755
You can also try this...
<%= text_field_tag :barcode, params[:barcode], :id => 'autocomplete' %>
Upvotes: 1
Reputation: 1534
try this
<%= text_field_tag :barcode, params[:barcode], id: 'autocomplete' %>
Upvotes: 27