Hope t
is a form object, then Try with:
<div class="row">
<%= t.label :name, 'Due Date' %><br>
<%= t.text_field :due_date, :value => "", :id=>"datepicker" %>
</div>
Hope it helps :)
Domanda
I have the following in a form,
<div class="row">
<%= t.label :name, 'Due Date' %><br>
<%= t.text_field :due_date, id: 'datepicker' %>
</div>
The id
attribute is required to show jquery datepicker
. But rails replaces the id
attribute value with the field name
of the form i.e due_date. This causes validation error for first time date selection but works fine in second time selection.It should not show validation error when date is selected for first time.
I would appreciate your help.
Soluzione
Hope t
is a form object, then Try with:
<div class="row">
<%= t.label :name, 'Due Date' %><br>
<%= t.text_field :due_date, :value => "", :id=>"datepicker" %>
</div>
Hope it helps :)