[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to pass values to form action

malugu satyajit

12/14/2007 6:35:00 AM

[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.

--
Regards,
M.Satyajit

1 Answer

Craig Johnson

12/14/2007 3:48:00 PM

0

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:malugu.satyajit@gmail.com]
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.

--
Regards,
M.Satyajit