# Form\_tag params hash doesn't contain form data

**URL:** <https://www.ruby-forum.com/t/form-tag-params-hash-doesnt-contain-form-data/163374>\
**Category:** Rails\
**Created:** [March 19, 2009, 5:58pm UTC](https://www.ruby-forum.com/t/form-tag-params-hash-doesnt-contain-form-data/163374 "2009-03-19T17:58:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RailSoft](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@RailSoft](https://www.ruby-forum.com/u/RailSoft)\
**Post date:** [March 19, 2009, 5:58pm UTC](https://www.ruby-forum.com/t/form-tag-params-hash-doesnt-contain-form-data/163374/1 "2009-03-19T17:58:04Z")

</div>

Hi,

```
 I have a check box in a non - model based form and when I submit

```

the form with ‘Un Checked’ check box the params hash doesn’t contain  
the check box. Whenever I submit the form with the check box  
‘Checked’, I see the same coming through params hash in my controller.  
Since I dynamically generate the form element (Here, check box), if I  
don’t get anything in the params, there is no way of telling if the  
check box is ‘unchecked’ or there is no check box in the form. Can  
someone help me understand what I am missing here and how to force  
Rails to include all the form elements in the params hash irrespective  
of the user action? I tried asking many people and no one seems to  
know the answer. Any help is highly appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![RailSoft](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@RailSoft](https://www.ruby-forum.com/u/RailSoft)\
**Post date:** [March 19, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/form-tag-params-hash-doesnt-contain-form-data/163374/2 "2009-03-19T18:01:35Z")

</div>

On Mar 19, 4:35 pm, RailSoft [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Rails to include all the form elements in the params hash irrespective  
> of the user action? I tried asking many people and no one seems to  
> know the answer. Any help is highly appreciated.

This isn’t a rails thing - the html standard dictates that unchecked  
check boxes submit no value.  
The rails check\_box (but not check\_box\_tag ) helper makes this a  
little friendlier by actually generating two input fields: a check box  
and a hidden field: if the check box is ticked then rails ignores the  
hidden input (because it has the same name and comes afterwards) if it  
isn’t then only the hidden field is checked.

Fred
