Forum: Ruby on Rails pass hidden field to the controller

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D63980ae502f0f3e827baf95c32166ee?d=identicon&s=25 Prabesh Shrestha (prabesh)
on 2009-05-21 16:31
(Received via mailing list)
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.
5772c599ccab3081e0fffb1d54f3b6de?d=identicon&s=25 Andrew Timberlake (andrewtimberlake)
on 2009-05-21 17:18
(Received via mailing list)
On Thu, May 21, 2009 at 4:30 PM, prabesh shrestha <prabesh708@gmail.com>
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 Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain
D63980ae502f0f3e827baf95c32166ee?d=identicon&s=25 Prabesh Shrestha (prabesh)
on 2009-05-21 17:46
(Received via mailing list)
Thanks Andrew.

On May 21, 8:17 pm, Andrew Timberlake <and...@andrewtimberlake.com>
This topic is locked and can not be replied to.