How to do this ?

30 views
Skip to first unread message

Fahim Patel

unread,
Sep 24, 2012, 8:01:33 AM9/24/12
to rubyonra...@googlegroups.com


I wish to select one value from drop down and second drop down should shows those values which are related to that  selected value 
from first drop down.

It should be dynamic ?

Did i have to use Ajax ?

KUL KING

unread,
Sep 24, 2012, 8:03:35 AM9/24/12
to rubyonra...@googlegroups.com
It should be done using javascript. Or if you want to get the values of second dropdown from server then you have to use AJAX.


--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/3iixrYOu9EAJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Kashif Umair Liaqat

unread,
Sep 24, 2012, 8:04:27 AM9/24/12
to rubyonra...@googlegroups.com
It should be done using javascript. Or if you want to get the values of second dropdown from server then you have to use AJAX.

Fahim Patel

unread,
Sep 24, 2012, 8:09:53 AM9/24/12
to rubyonra...@googlegroups.com
can i get tutorial and help ful links ..
I wish use both javascript and Ajax..

Kashif Umair Liaqat

unread,
Sep 24, 2012, 8:12:24 AM9/24/12
to rubyonra...@googlegroups.com
I don't have specific tutorials to follow. Google is your best companion for this purpose. If you can share some of your code then I can help you to take a start.

Fahim Patel

unread,
Sep 25, 2012, 10:07:25 AM9/25/12
to rubyonra...@googlegroups.com
code :

Area
<%= f.select :area_id, Area.all.collect {|p| [ p.name, p.id ] }, :class=>"small"  %>
Milk Mans
<%= f.select :milkman_id, Milkman.all.collect {|p| [ p.name, p.id ] }, :class=>"small"  %>

When i select any area then i should see only those milkmans of that area.
Till now i getting all milkmans in my select box. 

How to do this with Ajax ?

Hope u will understand  question now ?


On Monday, September 24, 2012 5:31:33 PM UTC+5:30, Fahim Patel wrote:

KUL KING

unread,
Sep 25, 2012, 10:14:04 AM9/25/12
to rubyonra...@googlegroups.com
I understood the question but I don't know that why I am unable to answer this. I think you should provide me the HTML code which is shown in page source after the page is loaded. It's embarrassing for me that I am unable to understand the code in your html.erb file.
Reply all
Reply to author
Forward
0 new messages