Friday, July 20, 2012

[Rails] How to add button to pass drop down menu selection to controller

Hi, I want to link the selections from a drop down menu in my view to a
controller action. Here's the code for my view:

[code]<select>
<option><%= link_to "option A", :controller => "scriptrunner", :action
=> "runoptionA" %></option>
<option><%= link_to "option B", :controller => "scriptrunner", :action
=> "runoptionB" %></option>
<option><%= link_to "option C", :controller => "scriptrunner", :action
=> "runoptionC" %></option>
</select>
[/code]

Right now when I select an option from the drop down menu, nothing is
called in my controller. Is there a way to add a "GO" button, so after I
select something from the menu, I can click the GO button and it will
call the corresponding action in my controller?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate