How to access a form value in template from controller

I have this in my template

<%= hidden_field(:content_provider, :id, {:value => '1'}) %>

How do I get it's value (1) in my controller?

When you post the form to your controller you access that via, params[:content_provider][:id]

I need to get the value of the hidden_field before the page is rendered.

I'm sure it's possible. I just want to set a variable in my view, and access it in my controller when the page is being built. In this case the variable is the hidden_field's value.

You can't get it before the page is rendered, as it hasn't been rendered yet? If your trying to use that to determine some kind of user state, then you should: a. Not put logic like that in a view b. Store a variable either in the url or in the session and pull it out of there to use in your controller method that creates this page.

Or if you really feel you must use this way, you could write an Ajax javascript post that would post it to the server. Either way you will need to post a form value to the server, you can't "grab" those from your controller. What exactly are you trying to do, I'm not 100% sure your on the right track?

Cam