jquery - Syntax error with datepicker -


datepicker working selecting date not saving database. trying several options show in code below still not working. code give me error. how format f.text_field?

           <div class="form-group">            <label class="control-label col-sm-5" for="time_stop">job date:</label>            <div class="col-sm-7">              <%= f.text_field :jobdate, :id => @appointment.jobdate, "data-provide" => 'datepicker', @appointment.jobdate, class: "form-control" %>            </div>            <script>   $(function() {     $( "#jobdate" ).datepicker();   });   </script>         </div> 

the error message:

/home/ubuntu/workspace/agss/app/views/appointments/_form.html.erb:95: syntax error, unexpected ',', expecting => ...epicker', @appointment.jobdate, class: "form-control" );@out... ... ^

the order of parameters wrong. should be

<%= f.text_field :jobdate, "data-provide" => 'datepicker', class: "form-control" %> 

not

<%= f.text_field :jobdate, :id => @appointment.jobdate, "data-provide" => 'datepicker', @appointment.jobdate, class: "form-control" %> 

note can't pass @appointment.jobdate because value taken object coupled form.

notice f.. form builder, not standard text_field_tag helper.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -