Check_box_tag


#1

hi,

What’s the right way to use the CHECK_BOX_TAG?

I used:

<% for @pippo in @model %>
<%= check_box_tag (:scelta,@pippo) %>
<% end %>

How Can I control if a person choosen the second or third element of the
vector @pippo?


#2

You need to use this form

<%= check_box_tag(‘scelta[]’, @pippo) %>

then in controller you can access params[:scelta] as collection which
you
can iterate through and do the required checks