Reputation: 48490
I have a form I'm marking up in HAML. Attempting to add the following text_field
is not working proper.
= text_field :gamedate, {:id => 'datepicker'}
This ends up with the following HTML:
<input id="gamedate_{:id=>"datepicker"}" type="text" name="gamedate[{:id=>"datepicker"}]">
How do I just get a name and id of gamedate
-- the output above looks broken and I'm guessing that I'm using text_field
incorrectly. This isn't tied to a model of any sort, I'm using form_tag
and not form_for
Upvotes: 0
Views: 106
Reputation: 44715
It is working corrctly. You want:
= text_field nil, :gamedate, id: 'datepicker'
or better
= text_field_tag :gamedate, id: 'datepicker'
Read: http://apidock.com/rails/ActionView/Helpers/FormHelper/text_field
Upvotes: 2
Reputation: 19889
You need text_field_tag
.
= text_field :gamedate, 'defaultvaluehere', :id => 'datepicker'
Upvotes: 2