Hi- I''m trying to implement the elusive country-state connected select boxes. I have a controller: ... def get_states @states = State.find(:all, :conditions => {:country_id => 1}) render :partial => "state_options" end (this is the ajax call) and a template: <% form_for :user, @user, :url => { :action => "create" } do |form| %> <%= render :partial => ''form'', :locals => { :form => form, :genders => @genders} %> <%= submit_tag "Create" %> <%end%> <%= observe_field("user_country", :url => {:action => :get_states,:update => "mydiv"}) %> <%end%> and a partial, which simply generates the <option></option> tags in between the <select></select> tags. the first time it''s rendered, it creates an empty <select> pair: ... <p> <label> State<br/> <select id="user_state" name="user[state]"></select> </label> </p> ... If I enter the partial URL directly into the browser, it works. If I replace the observe_field target with a simple alert javascript function, it works, so I know the syntax and partial are correct. The problem is, it just won''t update the web browser page. I never see any change. Any ideas why? Thanks, Dino --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
=> :get_states,:update => "mydiv"}) %> <====OOPS , should say: <%= observe_field("user_country", :url => {:action => :get_states}, :update => "user_states") %> --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Dino, I can only see a "user_state" id (<select id="user_state" name="user[state]"></select>), not a "user_states" id as you described above. Have you tried using the Firebug add-on for Firefox? I would definitely recommend it when trying to debug AJAX requests. Jabbslad On Feb 27, 10:36 pm, "dino d." <dinodorr...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> => :get_states,:update => "mydiv"}) %> <====> OOPS , should say: > > <%= observe_field("user_country", :url => {:action > => :get_states}, :update => "user_states") %>--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Jabbslad- It was not quite this, but it was a naming issue. Thanks for your help. Dino On Feb 27, 7:15 pm, Jabbslad <jabbs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Dino, > > I can only see a "user_state" id (<select id="user_state" > name="user[state]"></select>), not a "user_states" id as you described > above. > > Have you tried using the Firebug add-on for Firefox? I would > definitely recommend it when trying to debug AJAX requests. > > Jabbslad > > On Feb 27, 10:36 pm, "dino d." <dinodorr...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > => :get_states,:update => "mydiv"}) %> <====> > OOPS , should say: > > > <%= observe_field("user_country", :url => {:action > > => :get_states}, :update => "user_states") %>--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---