# How to use the observe\_field to get more than one field?

**URL:** <https://www.ruby-forum.com/t/how-to-use-the-observe-field-to-get-more-than-one-field/156181>\
**Category:** Rails\
**Created:** [December 22, 2008, 8:58am UTC](https://www.ruby-forum.com/t/how-to-use-the-observe-field-to-get-more-than-one-field/156181 "2008-12-22T08:58:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sreekanth.G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@sreekanth.G](https://www.ruby-forum.com/u/sreekanth.G)\
**Post date:** [December 22, 2008, 8:58am UTC](https://www.ruby-forum.com/t/how-to-use-the-observe-field-to-get-more-than-one-field/156181/1 "2008-12-22T08:58:58Z")

</div>

Hi,

I have two selctdropdown boxes name like “resolution” and “codecname”.

Now i am able to get the single field value either from resolution or  
codecformat select box.  
ex:  
observe\_field ‘resolution’  
or  
observe\_field ‘codecforamt’

is there any way to get the two fields in to the observe\_field method ?

Can anyone give me suggestionfs or ideas on this?

thanks  
Srikanth

---

<div class="post-metadata">

**Author:** ![sreekanth.G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@sreekanth.G](https://www.ruby-forum.com/u/sreekanth.G)\
**Post date:** [December 23, 2008, 4:23am UTC](https://www.ruby-forum.com/t/how-to-use-the-observe-field-to-get-more-than-one-field/156181/2 "2008-12-23T04:23:19Z")

</div>

On Sun, Dec 21, 2008 at 11:58 PM, sreekanth. G [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I have two selctdropdown boxes name like “resolution” and “codecname”.
> 
> Now i am able to get the single field value either from resolution or  
> codecformat select box.

> is there any way to get the two fields in to the observe\_field method ?

Have you read the docs for the :with option? Seems like it should be  
just what you need:

“A JavaScript expression specifying the parameters for the  
XMLHttpRequest…”

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![sreekanth.G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@sreekanth.G](https://www.ruby-forum.com/u/sreekanth.G)\
**Post date:** [December 23, 2008, 1:49pm UTC](https://www.ruby-forum.com/t/how-to-use-the-observe-field-to-get-more-than-one-field/156181/3 "2008-12-23T13:49:18Z")

</div>

sreekanth.G wrote:

> Hi,
> 
> I have two selctdropdown boxes name like “resolution” and “codecname”.
> 
> Now i am able to get the single field value either from resolution or  
> codecformat select box.  
> ex:  
> observe\_field ‘resolution’  
> or  
> observe\_field ‘codecforamt’
> 
> is there any way to get the two fields in to the observe\_field method ?

Have you looked at the observe\_form method. I think you use this if you  
want to observe multiple fields in a form. I could be wrong, but at  
least take a look at it.
