# Partial refresh not working, but no errors

**URL:** <https://www.ruby-forum.com/t/partial-refresh-not-working-but-no-errors/132469>\
**Category:** Rails\
**Created:** [March 20, 2008, 2:38pm UTC](https://www.ruby-forum.com/t/partial-refresh-not-working-but-no-errors/132469 "2008-03-20T14:38:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [March 20, 2008, 2:38pm UTC](https://www.ruby-forum.com/t/partial-refresh-not-working-but-no-errors/132469/1 "2008-03-20T14:38:44Z")

</div>

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  
}) %\>

&nbsp;

\<%= observe\_field :state\_code, :url =\> {:action =\> ‘get\_city\_list’},  
:with =\> ‘state\_code’ %\>

THANKS!

---

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [March 20, 2008, 2:57pm UTC](https://www.ruby-forum.com/t/partial-refresh-not-working-but-no-errors/132469/2 "2008-03-20T14:57:43Z")

</div>

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

> =\> :state\_code  
> }) %\>
> 
> &nbsp;
> 
> \<%= 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

---

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [March 20, 2008, 3:41pm UTC](https://www.ruby-forum.com/t/partial-refresh-not-working-but-no-errors/132469/3 "2008-03-20T15:41:05Z")

</div>

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!!!
