# Pass hidden field to the controller

**URL:** <https://www.ruby-forum.com/t/pass-hidden-field-to-the-controller/168505>\
**Category:** Rails\
**Created:** [May 21, 2009, 4:31pm UTC](https://www.ruby-forum.com/t/pass-hidden-field-to-the-controller/168505 "2009-05-21T16:31:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prabesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@prabesh](https://www.ruby-forum.com/u/prabesh)\
**Post date:** [May 21, 2009, 4:31pm UTC](https://www.ruby-forum.com/t/pass-hidden-field-to-the-controller/168505/1 "2009-05-21T16:31:33Z")

</div>

How do I get the value form the hidden field and pass it to the  
controller?Also how do I get the value in the controller.

---

<div class="post-metadata">

**Author:** ![prabesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@prabesh](https://www.ruby-forum.com/u/prabesh)\
**Post date:** [May 21, 2009, 5:18pm UTC](https://www.ruby-forum.com/t/pass-hidden-field-to-the-controller/168505/2 "2009-05-21T17:18:30Z")

</div>

On Thu, May 21, 2009 at 4:30 PM, prabesh shrestha [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> How do I get the value form the hidden field and pass it to the  
> controller?Also how do I get the value in the controller.

If you include a hidden field in a form, you can access it from params  
in the controller

so, if you have the following in the view  
hidden\_field\_tag ‘field\_name’, ‘value’

You can get it in the controller as  
params[:field\_name]

Andrew T.  
[http://ramblingsonrails.com](http://ramblingsonrails.com)  
[http://www.linkedin.com/in/andrewtimberlake](http://www.linkedin.com/in/andrewtimberlake)

“I have never let my schooling interfere with my education” - Mark Twain

---

<div class="post-metadata">

**Author:** ![prabesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@prabesh](https://www.ruby-forum.com/u/prabesh)\
**Post date:** [May 21, 2009, 5:46pm UTC](https://www.ruby-forum.com/t/pass-hidden-field-to-the-controller/168505/3 "2009-05-21T17:46:43Z")

</div>

Thanks Andrew.

On May 21, 8:17 pm, Andrew T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
