Maki
Maki

Reputation: 913

rails3 form_tag

I have a view with a form_tag,

<table class="center">
  <%= render @products %>     
</table> 
<%= form_tag write_offs_path, :remote => true, :id => "add_write_off" do %> 
<%= submit_tag "Write off", :id => "set_write_off" %><br/>
<%= text_area_tag 'comment', nil, :size => "100x5", :id => "write_off_comment" %> 
<% end %>

in products patrial I have

<% check_box_name = product.class.table_name + "[]" -%>
<tr>
 ....
 <td>
    <%= check_box_tag check_box_name, product.id %>
  </td>
</tr>

Now when I select some checkboxes and press the submit button, only comment form text_area comes into params, but the products checkbox values array didn't come, how to solve it?

Upvotes: 0

Views: 1726

Answers (1)

Leonid Shevtsov
Leonid Shevtsov

Reputation: 14189

Your partial must be rendered inside the form_tag to be a part of the form.

Upvotes: 3

Related Questions