How to pass values to form action

M

malugu satyajit

[Note: parts of this message were removed to make it a legal post.]

I have some ERB which has two lists
like this <select name="selectedSurveys" multiple="multiple" size="7">

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

<select name="selectedSurveys" multiple="multiple" size="7">
<%x=0
@string=survey+x
params[:string]=%><option value=""..... >

<%x++%>
</select>
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.
 
C

Craig Johnson

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

-----Original Message-----
From: malugu satyajit [mailto:[email protected]]
Sent: Thursday, December 13, 2007 11:35 PM
To: ruby-talk ML
Subject: How to pass values to form action

I have some ERB which has two lists
like this <select name="selectedSurveys" multiple="multiple" size="7">

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

<select name="selectedSurveys" multiple="multiple" size="7">
<%x=0
@string=survey+x
params[:string]=%><option value=""..... >

<%x++%>
</select>
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,274
Messages
2,571,366
Members
48,051
Latest member
noblesalt

Latest Threads

Top