0

我在将 id="my-form" 添加到我的表单时遇到问题:

<tr>
<%= form_for([@patient, @patient.treatments.build], :id => "my_form") do |f|%>
<th><%= f.collection_select :category_id, Category.find(:all), :id, :typ %></th>
<th><%= f.text_field :content , :id => "inputbox"%></th>
<th><%= f.text_field :day, :value => Date.today %></th>
<th><%= f.submit  :class => 'btn btn-small btn-primary searsa'%></th>
<% end %>
</tr>

你会怎么做?我也试过:

<%= form_for, :id => "my_form"([@patient, @patient.treatments.build]) do |f|%>
4

1 回答 1

2

请试试:

<%= form_for([@patient, @patient.treatments.build], :html => { :id => "my_form" }) do |f|%>
于 2013-07-21T22:09:13.247 回答