Rails 3.1 text_field form helper and jQuery datepicker date format

前端 未结 4 869
死守一世寂寞
死守一世寂寞 2021-01-06 04:19

I have a form field in my Rails view like this:

<%= f.text_field :date, :class => \"datepicker\" %>

A javascript function converts

4条回答
  •  逝去的感伤
    2021-01-06 04:45

    SOLVED: I pass in the :value => show.date as suggested by Jayendra above. The reason it wasn't working was because I didn't pass in the show object from the parent view. I changed the render line to include it - the parent view now looks like this:

    <%= form_tag("/shows/update_individual", :method => "put") do %>
        <% for show in @shows %>
            <%= fields_for "shows[]", show do |f| %>
                <%= render "fields", :f => f, :show => show %>
            <% end %>
        <% end %>
        <%= submit_tag "Submit"%>
    <% end %>
    

提交回复
热议问题