# Observe\_field - problems saving form values

**URL:** <https://www.ruby-forum.com/t/observe-field-problems-saving-form-values/119060>\
**Category:** Rails\
**Created:** [November 2, 2007, 6:27pm UTC](https://www.ruby-forum.com/t/observe-field-problems-saving-form-values/119060 "2007-11-02T18:27:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![randall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b38774/32.png) [@randall](https://www.ruby-forum.com/u/randall)\
**Post date:** [November 2, 2007, 6:27pm UTC](https://www.ruby-forum.com/t/observe-field-problems-saving-form-values/119060/1 "2007-11-02T18:27:34Z")

</div>

Hi, I have a form that has two drop down lists in it. I have an  
observe\_field for the first list, that updates the second list.

To better visualize this, the first list is country, the second is  
county.

Now all this works fine, the second list is basically a partial and is  
called correctly and retrieves the correct data when the first list is  
changed.

However, in my edit page, if i save the form only the first list value  
is saved. The second list value remains the same even if i change the  
value on the list.

Additionally, if i edit the record and only change the second lists’  
value it saves the correct data!

Is there a problem with observe\_field rendering partials in an edit  
page that messes up the field values? I looked at the generated html  
and it all looks the same. Any ideas?

Thanks in advance,

Mike

---

<div class="post-metadata">

**Author:** ![randall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b38774/32.png) [@randall](https://www.ruby-forum.com/u/randall)\
**Post date:** [November 3, 2007, 5:10pm UTC](https://www.ruby-forum.com/t/observe-field-problems-saving-form-values/119060/2 "2007-11-03T17:10:41Z")

</div>

Mike,  
I’ve been trying to find an example of how to use this ‘double’  
dropdown list box for the last months and never found an example.  
Would you be so kind as to offer up a simple example of how you’re  
approaching this? I would be most grateful as I have need to do the  
‘category - subcategory’ entry for a project and have had to make it  
very awkward to try to accomplish this.  
Thank you,  
Kathleen  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![randall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b38774/32.png) [@randall](https://www.ruby-forum.com/u/randall)\
**Post date:** [November 5, 2007, 11:19am UTC](https://www.ruby-forum.com/t/observe-field-problems-saving-form-values/119060/3 "2007-11-05T11:19:34Z")

</div>

I’ll post a working example as soon as i can, but i’m still having  
problems saving the correct data.

I’m using a partial for the second drop down, so when the first drop  
down is changed the observe\_field kicks in and renders the partial  
with the new list.

On Nov 3, 4:09 pm, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![randall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b38774/32.png) [@randall](https://www.ruby-forum.com/u/randall)\
**Post date:** [November 5, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/observe-field-problems-saving-form-values/119060/4 "2007-11-05T12:00:33Z")

</div>

Hmm how about this example?

[http://mudabone.com/aietc/?page\_id=410](http://mudabone.com/aietc/?page_id=410)

I tried this with 2 drop down lists, the first one containing a list  
of publications and the second one containing a list of available  
issues for the selected publication. Worked without any problem 🙂

---

<div class="post-metadata">

**Author:** ![randall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b38774/32.png) [@randall](https://www.ruby-forum.com/u/randall)\
**Post date:** [November 5, 2007, 2:46pm UTC](https://www.ruby-forum.com/t/observe-field-problems-saving-form-values/119060/5 "2007-11-05T14:46:46Z")

</div>

Thanks for the link, i’ll try this later.

A small update from me; my original code works in ie6 and ie7! but my  
development browser Firefox fails!!! I’ll look into this more and  
report back once i have an answer.
