# Strange parameters with check box

**URL:** <https://www.ruby-forum.com/t/strange-parameters-with-check-box/127823>\
**Category:** Rails\
**Created:** [February 1, 2008, 4:46pm UTC](https://www.ruby-forum.com/t/strange-parameters-with-check-box/127823 "2008-02-01T16:46:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [February 1, 2008, 4:46pm UTC](https://www.ruby-forum.com/t/strange-parameters-with-check-box/127823/1 "2008-02-01T16:46:08Z")

</div>

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
