Partial refresh not working, but no errors

I’ve got a partial that I’m trying to refresh, but I don’t get back any
results, nor do I see any errors in Firebug. I’m guessing there’s a
problem with the DOM, but I’m not sure. Can someone else take a look
and let me know where I’m missing something?

Controller:

def get_city_list
@show_javascript = true
@counties = StateList.find_by_state_code(params[:state_code])
render :update do |page|
page.replace_html ‘city_select’, :partial => ‘city_list’
end

View:

<%= collection_select (:state_code, :state_code,StateList.find(:all,
:order => “state ASC”, :select => ‘distinct state, state_code’),
:state_code, :state, {:prompt => ‘Select a state’}, {:id => :state_code
}) %>

 

<%= observe_field :state_code, :url => {:action => ‘get_city_list’},
:with => ‘state_code’ %>

THANKS!

On 20 Mar 2008, at 13:38, Becca G. wrote:

=> :state_code
}) %>

 

<%= observe_field :state_code, :url => {:action => ‘get_city_list’},
:with => ‘state_code’ %>

Have you checked that state_code is actually the id of the form
element you’re interested in? I would expect it to be more like
state_code_state_code based on what you’ve got above.

Fred

Frederick C. wrote:

Have you checked that state_code is actually the id of the form
element you’re interested in? I would expect it to be more like
state_code_state_code based on what you’ve got above.

Thanks for your help.

I had thought that I needed to observe :state_code, but I actually
needed to observe ‘state_code’

THANKS!!!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs