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 Doe Jane })) %> <%= link_to "Delete", { :controller => "myname", :action => "add", :id => name }, :confirm => "Are you sure}?" %> Thanks Meenal --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have this way: <% form_tag { :controller => "myname", :action => "add", :id => name }, "name"=>"jump" do %> <%= select_tag ("name", options_for_select(%w{John Doe Jane }), "onChange"=>"location=document.jump.menu.options[document.jump.menu.selectedIndex].value;", "value"=>"GO") %> <% end %> <% end_form_tag %> I am not sure that my way is correct. Maybe any reference from other partner here? Reinhart http://teapoci.blogspot.com -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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="..." ...>...</a>, 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. -Kyle On Apr 24, 12:06 am, Visit Indonesia 2008 <rails-mailing-l...@andreas- s.net> wrote:> I have this way: > > <% form_tag { :controller => "myname", :action => "add", :id => name }, > "name"=>"jump" do %> > > <%= select_tag ("name", options_for_select(%w{John Doe Jane }), > "onChange"=>"location=document.jump.menu.options[document.jump.menu.selectedIndex].value;", > "value"=>"GO") %> > > <% end %> > <% end_form_tag %> > > I am not sure that my way is correct. Maybe any reference from other > partner here? > > Reinharthttp://teapoci.blogspot.com > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---