# Observe\_field not working on dependeng collection\_select

**URL:** <https://www.ruby-forum.com/t/observe-field-not-working-on-dependeng-collection-select/188844>\
**Category:** Rails\
**Created:** [May 19, 2010, 9:36am UTC](https://www.ruby-forum.com/t/observe-field-not-working-on-dependeng-collection-select/188844 "2010-05-19T09:36:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianneub](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/34f0e0/32.png) [@ianneub](https://www.ruby-forum.com/u/ianneub)\
**Post date:** [May 19, 2010, 9:36am UTC](https://www.ruby-forum.com/t/observe-field-not-working-on-dependeng-collection-select/188844/1 "2010-05-19T09:36:39Z")

</div>

Setup:

I have 3 drop downs generated by collection\_select, where in the next  
drop down’s option values are dependent on which option value was  
selected in the previous drop down. This is done using observe\_field.

e.g.  
country =\> state =\> city

Here’s the code:  
%div  
.label  
Grading Scheme Select - Tier 1  
= collection\_select (:grading\_scheme, :id, GradingScheme.all, :id,  
:name)  
= observe\_field(‘grading\_scheme\_id’, :update =\> ‘parent\_div’,  
:frequency =\> 0.5, :url =\> {:controller =\> ‘grading\_schemes’, :action =\>  
‘filter\_parents’}, :with =\> ‘grading\_scheme\_id’)  
%div  
.label  
Tier 2  
#parent\_div  
= collection\_select (:grade\_layer, :id, @parents, :id, :name)  
= observe\_field(‘grade\_layer\_id’, :update =\> ‘child\_div’, :frequency  
=\> 0.5, :url =\> {:controller =\> ‘grading\_schemes’, :action =\>  
‘filter\_children’}, :with =\> ‘id’)  
%div  
.label  
Tier 3  
#child\_div  
= collection\_select (:grade\_layer, :id, @children, :id, :name)

Initially the observe\_field would work on updating child\_div (Tier  
3)whenever I select a different item in Tier 2. If I select a grading  
scheme in Tier 1, Tier 2 will update its list. However if i select a new  
item in that updated list in Tier 2, Tier 3 will not update.

I’ve checked my local server, and during those occassions that Tier 3  
doesn’t update i find that ajax isn’t producing any calls. I hope  
someone can help me out on this.
