Hi all,
I have a form that contains a list of patricipants of an event and their corresponding presence on that event.
My form looks like (simplified) <% form_for @user do |f| %> <% @users.each do |user| %> <% fields_for "event[registration_attributes]", registration do | registration_f| %> <%= registration_f.check_box :present, :index => nil %> <%= registration_f.hidden_field :id, :index => nil %> <%= registration_f.hidden_field :user_id, :index => nil %> <% end %> <% end %> <% end %>
I use a checkbox to show and alter the presence state of the user. the problem is that the checkbox submits some strange parameters: - If I simply use a text_box (where the check_box is now) I receive a hash (1 hash for every users with present, id and user_id in) - If I use a check_box on the other hand I get a hash for every checked check box + a hash for every user where the present attribute is always 0.
Why is there a difference between a check_box and text_field?
Regards, Stijn