# hidden fields params

**URL:** <https://discuss.rubyonrails.org/t/hidden-fields-params/21831>\
**Category:** rubyonrails-talk\
**Created:** [December 17, 2007, 3:05am UTC](https://discuss.rubyonrails.org/t/hidden-fields-params/21831 "2007-12-17T03:05:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_White2](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@Craig\_White2](https://discuss.rubyonrails.org/u/Craig_White2)\
**Post date:** [December 17, 2007, 3:05am UTC](https://discuss.rubyonrails.org/t/hidden-fields-params/21831/1 "2007-12-17T03:05:32Z")

</div>

> Ok, I'm working dilegently on my question from yesterday and I will post the answer once I get one working... but I'm having problems on an interim stage.
> 
> Hidden field basics...I really wrestle getting things in and out of parameters from view to controller so I'm trying this simple approach.
> 
> \<% for person in @people %\> \<% [Santa, Elf, Reindeer].each do |holiday\_character| %\> &nbsp;&nbsp;\<div\> &nbsp;&nbsp;&nbsp;\<% form\_tag :action =\> :manipulate\_based\_on\_input do %\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you click the button below this person : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<% image\_tag (peron.photo\_url) %\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;will be tranformed into a\<%=h holiday\_character %\>
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= hidden\_field( :holder1, :value =\> person.id )%\>
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= hidden\_field( :holder2, :value =\> holiday\_character ) %\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<% submit\_tag "click here" %\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<% end %\> &nbsp;&nbsp;\</div\> &nbsp;&nbsp;\<% end %\> \<% end %\>
> 
> Ok hopefully I didnt make any typos above because it isnt my exact code thats on a different machine.
> 
> MY problem is that the params from the hidden fields look strange.
> 
> If I force an error to look at my params I get something like:
> 
> { "commit"=\>"click here", "holder1" =\>{"value166"=\>""}, "holder1" =\>{"valueSanta"=\>""} }
> 
> what I want (I think) is more like {. .. , "holder1" =\> "166", "holder2" =\> "Santa" }
> 
> If I instead use a hidden\_ield like: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= hidden\_field( :holder2, holiday\_character ) %\> my params look more like {.... , "holder2"=\>{"Santa"=\>""}, ....}
> 
> Can I get a simple params like "holder2"=\>"Santa" .??
> 
> If not which of the two alternatives should I use and how do I access the info in the params?
> 
> ?? params[:holder2][value] ?? (will it work even with the "value166"="" subhash?)

---

<div class="post-metadata">

**Author:** ![mcf19861](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@mcf19861](https://discuss.rubyonrails.org/u/mcf19861)\
**Post date:** [January 21, 2008, 10:25am UTC](https://discuss.rubyonrails.org/t/hidden-fields-params/21831/2 "2008-01-21T10:25:37Z")

</div>

You may have fixed this by now, but for anyone else. it's hidden\_field\_tag.

Matt
