Hi
I have three drop downs (State, City, Locality) and would like to
populate
City based on State selection and Locality based on City selection.
I have observers on two fields (State, and City). The observer_field on
state
works fine and it populates city based on state selection. But the
observer
on city doesn’t populate Locality. Now sure whats wrong with my code.
here is the code snippet
RHTML Code:
Controller Code
def select_city
@cities = City.find_all_by_state_id(@params[“id”])
@html = “”
@html += “Select City”
@cities.each do |@city|
@html += “#{@city.city_name}”
end
@html += “”
render_text @html
end
def select_locality
@localities = Locality.find_all_by_city_id(@params[“id”])
@html = “”
@html += “Select Locality”
@localities.each do |@locality|
@html += “#
{@locality.locality_name}”
end
@html += “”
render_text “test”
render_text @html
end
I tried with render_text “test” just to make sure that i get the text
“test”
back on selecting City. But that also doesn’t work. Is there a work
around?
Thx for your help,
Ramanan
PS : I have tried with the Cascading SELECT using AJAX but it did not
work with both IE and FF. Did anyone encounter this kind of situation?