Hello everyone
I have this ajax issue, I'd be glad if someone would be willing to help, thanks
What I try to do: Have a select box with a list of countries. When the country select box value is changed, have the state box appear. Up to this point, I got this successfully.
When the state box gets changed, have the city box appear for selection. This is what I couldn't acheive...
How I coded it: In my rhtml page I got this code:
<%= select "assoc", "country_id", @country_options, {:include_blank => true} %> <%= observe_field(:assoc_country_id, Â Â Â Â Â Â Â Â :frequency => 0.5, Â Â Â Â Â Â Â Â :update => :states, Â Â Â Â Â Â Â Â :url => { :action => :show_states_select }, Â Â Â Â Â Â Â Â :with => "'country_id=' + value") %>
In show_states_select.rhtml, I got this: <%= select 'assoc', 'state_id', @state_options, {:include_blank => true} %> </td> <td> <div id="cities"></div>
<%= observe_field(:assoc_state_id, Â Â Â Â Â Â Â Â :frequency => 0.5, Â Â Â Â Â Â Â Â :update => :cities, Â Â Â Â Â Â Â Â :url => { :action => :show_cities_select }, Â Â Â Â Â Â Â Â :with => "'state_id=' + value") %>
And show_cities_select.rhtml: <%= select 'user', 'city_id', @city_options, {:include_blank => true} %>
I think it does not appear because maybe the second observe_field comes from ajax request and maybe is not interpreted, I don't know, if someone could help me, I'd appreciate...
Thank you