Forum: Ruby on Rails How to display the selected values from the drop down list menu in rails?

A6effe44b6742165bc3f06660d9120f6?d=identicon&s=25 yash shah (Guest)
on 2013-07-28 20:39
(Received via mailing list)
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 %>
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2013-07-28 23:18
(Received via mailing list)
On Sun, Jul 28, 2013 at 11:38 AM, yash shah <yashshah1800@gmail.com>
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@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.