# How can I get the value of a hidden field and pass it

**URL:** <https://www.ruby-forum.com/t/how-can-i-get-the-value-of-a-hidden-field-and-pass-it/64101>\
**Category:** Rails\
**Created:** [June 22, 2006, 1:31am UTC](https://www.ruby-forum.com/t/how-can-i-get-the-value-of-a-hidden-field-and-pass-it/64101 "2006-06-22T01:31:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barraorion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f04885/32.png) [@barraorion](https://www.ruby-forum.com/u/barraorion)\
**Post date:** [June 22, 2006, 1:31am UTC](https://www.ruby-forum.com/t/how-can-i-get-the-value-of-a-hidden-field-and-pass-it/64101/1 "2006-06-22T01:31:10Z")

</div>

My problem is that I want to pass a date information form one page to  
another. And that information came to my page in an Ajax petition.  
My idea to accomplish this is that the date can come in the Ajax  
response as a hidden field and when I click a link I can get that hidden  
field value and pass it to the action in rails as a param.  
I have done all this. I have the date in a hidden field and I have  
access to that field with “document.hidden\_form.hidden\_date.value” but I  
don’t know how to introduce this value in a rails variable as @date to  
pass it with  
\<%= link\_to ‘New event’, :action =\> ‘new’ , :date\_start\_day=\>@date%\>

thank you in advance

if you have any other idea about how to pass that information from an  
Ajax response to another page please tell me I have no more ideas

---

<div class="post-metadata">

**Author:** ![barraorion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f04885/32.png) [@barraorion](https://www.ruby-forum.com/u/barraorion)\
**Post date:** [June 22, 2006, 3:29am UTC](https://www.ruby-forum.com/t/how-can-i-get-the-value-of-a-hidden-field-and-pass-it/64101/2 "2006-06-22T03:29:26Z")

</div>

enrique barraorion wrote:

> My problem is that I want to pass a date information form one page to  
> another. And that information came to my page in an Ajax petition.  
> My idea to accomplish this is that the date can come in the Ajax  
> response as a hidden field and when I click a link I can get that hidden  
> field value and pass it to the action in rails as a param.  
> I have done all this. I have the date in a hidden field and I have  
> access to that field with “document.hidden\_form.hidden\_date.value” but I  
> don’t know how to introduce this value in a rails variable as @date to  
> pass it with  
> \<%= link\_to ‘New event’, :action =\> ‘new’ , :date\_start\_day=\>@date%\>
> 
> thank you in advance
> 
> if you have any other idea about how to pass that information from an  
> Ajax response to another page please tell me I have no more ideas

\<%= link\_to ‘New event’, :action =\> ‘new’ ,:with =\> “‘ate\_start\_day=’ +  
Form.Element.getValue(‘hidden\_field\_parameter’)”%\>
