Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
accessing the value chosen in a dropdown menu
James
6/28/2007 9:26:00 PM
I have an array of frame colors called @frame_color and I created a
dropdown menu that triggers a remote_function when the value is changed.
The problem is that I can't seem to figure out how to pass the value of
the selected string from the dropdown menu.
this is the code I have:
<%= select_tag(:frame_color, options_for_select(@frame_color), :onchange
=> remote_function(:update => "middle_sub_right", :url => {:action =>
'print_change', :color => params[:frame_color], :id => @prints, :photo
=> @photo}))%>
all I need is for this to happen; if someone picks brown from the
dropdown menu then brown will be passed to :color =>
thanks for any help.
--
Posted via
http://www.ruby-...
.
1 Answer
Bob Showalter
6/28/2007 10:02:00 PM
0
On 6/28/07, James <jamaher@gmail.com> wrote:
> I have an array of frame colors called @frame_color and I created a
> dropdown menu that triggers a remote_function when the value is changed.
> The problem is that I can't seem to figure out how to pass the value of
> the selected string from the dropdown menu.
>
> this is the code I have:
>
> <%= select_tag(:frame_color, options_for_select(@frame_color), :onchange
> => remote_function(:update => "middle_sub_right", :url => {:action =>
> 'print_change', :color => params[:frame_color], :id => @prints, :photo
> => @photo}))%>
(You should be asking on the Rails list. Rails != Ruby)
Anyway, that won't work, because params[:frame_color] is being
evaluated as the view is being rendered.
Use observe_field() for this; it handles passing the value to the
remote function for you.
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.ht...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
accessing the value chosen in a dropdown menu
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password