# How to pass values to form action

**URL:** <https://www.ruby-forum.com/t/how-to-pass-values-to-form-action/123122>\
**Category:** Ruby\
**Created:** [December 14, 2007, 7:35am UTC](https://www.ruby-forum.com/t/how-to-pass-values-to-form-action/123122 "2007-12-14T07:35:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![malugu\_satyajit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@malugu\_satyajit](https://www.ruby-forum.com/u/malugu_satyajit)\
**Post date:** [December 14, 2007, 7:35am UTC](https://www.ruby-forum.com/t/how-to-pass-values-to-form-action/123122/1 "2007-12-14T07:35:57Z")

</div>

I have some ERB which has two lists  
like this

I have JavaScript that enables one to push one object from one list to  
the  
other. So, now I want get all of the selected objects in the second list  
in  
my params array. How do I do that?

I am trying in the following lines

 \<%x=0 @string=survey+x params[:string]=%\>

```
<%x++%>

```

Here I am creating a new string everytime and trying to populate the params array with the value in the list box. But its not working.

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![malugu\_satyajit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@malugu\_satyajit](https://www.ruby-forum.com/u/malugu_satyajit)\
**Post date:** [December 14, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/how-to-pass-values-to-form-action/123122/2 "2007-12-14T16:51:24Z")

</div>

I ended up dealing with the same thing…

Insert a hidden variable in your form…  
then that hidden variable will be inserted into  
the params array when you hit submit…

I had  
\<Input type=“hidden” name"addedRight" value=""\>  
in the rhtml…  
the javascript populated the “addedRight” variable

then in the controller I pulled the values out with  
b=params[:addedRight]

works great
