yash shah
2013-Jul-28 18:38 UTC
How to display the selected values from the drop down list menu in rails?
Dear Guys, I have created the drop down list for state and city. Now when the user selects the state say florida and city say miami, I want to display these names on the new page when the user clicks the search link. Using link_to, I am not able to pass these names to the new page. Ideally these selected names should go as :paramsbut they arent going through the url .Please me know if its still not clear. Thanks a lot!! Heres the code: <%= form_for Investopp.new do |f| %><div class="field"><%= f.label :state_id %><br/><%= f.collection_select :state_id, Investopp.year_lookup(@state_ids), :label, :value, include_blank: true %></div> <div class="field"><%= f.label :city_id, "city" %><br /><%= f.grouped_collection_select :city_id, Investopp.year_lookup(@state_ids), :cities, :value, :id,:name, include_blank: true %></div><% end %><%= link_to ''Back'', investopps_path %><%= link_to ''Search'', investopps_browsedisplay_path %> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d8069271-0d1b-45d1-8984-18280072d620%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder
2013-Jul-28 21:15 UTC
Re: How to display the selected values from the drop down list menu in rails?
On Sun, Jul 28, 2013 at 11:38 AM, yash shah <yashshah1800-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have created the drop down list for state and city. Now when the user > selects the state say florida and city say miami, I want to display these > names on the new page when the user clicks the search link. Using link_to, > I am not able to pass these names to the new page.Correct, or at least not without JavaScript. The easiest way is to make ''Search'' a submit button inside the form. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yC-RuUGKgiA5RtLz9Wi8xG_hRMo%2B3bELf-pcqLkUnC%3Dqw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.