Select_tag and link_to

Does ROR allow passing the chosen value from a drop down using
select_tag into link_to ?

Basically I want to do something like:
<%= select_tag( “name”, options_for_select(%w{John D. Jane })) %>
<%= link_to “Delete”,
{ :controller => “myname”, :action => “add”,
:id => name },
:confirm =>
“Are you sure}?” %>


I have this way:

<% form_tag { :controller => “myname”, :action => “add”, :id => name },
“name”=>“jump” do %>

<%= select_tag (“name”, options_for_select(%w{John D. Jane }),
“value”=>“GO”) %>

<% end %>
<% end_form_tag %>

I am not sure that my way is correct. Maybe any reference from other
partner here?


Reinhart’s suggestion should work if the user has javascript, but I’d
be wary of doing that, especially for a “delete” link…although
you’re calling an “add” action…strange…

In general, link_to will render an <a href="…" …>…, and once
it’s on the page, it’s set. If you want a user to select something
from a box and use that value, use a form. If you don’t like form
buttons, try somehow getting a link_to to use onClick=form.submit. I
know very little about javascript, so check with others on how to
accomplish that.


On Apr 24, 12:06 am, Visit Indonesia 2008 <rails-mailing-l…@andreas-

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs