# AJAX observer on select form

**URL:** <https://www.ruby-forum.com/t/ajax-observer-on-select-form/139895>\
**Category:** Rails\
**Created:** [June 8, 2008, 7:47pm UTC](https://www.ruby-forum.com/t/ajax-observer-on-select-form/139895 "2008-06-08T19:47:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kopf1988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@kopf1988](https://www.ruby-forum.com/u/kopf1988)\
**Post date:** [June 8, 2008, 7:47pm UTC](https://www.ruby-forum.com/t/ajax-observer-on-select-form/139895/1 "2008-06-08T19:47:50Z")

</div>

Hi, I was hoping someone might be able to help with this one. I’ve got  
a select list that I probably need to use an observer on. I want the  
list, whenever something is selected, to show a hidden div based on  
what’s chosen. Basically people choose between cash, credit, or check,  
and then when they pick it will show a different div asking for more  
information. Any ideas?

---

<div class="post-metadata">

**Author:** ![kopf1988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@kopf1988](https://www.ruby-forum.com/u/kopf1988)\
**Post date:** [June 8, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/ajax-observer-on-select-form/139895/2 "2008-06-08T19:49:02Z")

</div>

Oh, and I know I can probably just use any Javascript to do this, but  
I really don’t like javascript cluttering my code if there’s a way I  
can write it in Ruby’s prototype/scriptaculous.

---

<div class="post-metadata">

**Author:** ![kopf1988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@kopf1988](https://www.ruby-forum.com/u/kopf1988)\
**Post date:** [June 8, 2008, 11:38pm UTC](https://www.ruby-forum.com/t/ajax-observer-on-select-form/139895/3 "2008-06-08T23:38:11Z")

</div>

On Jun 8, 6:46 pm, kopf1988 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi, I was hoping someone might be able to help with this one. I’ve got  
> a select list that I probably need to use an observer on. I want the  
> list, whenever something is selected, to show a hidden div based on  
> what’s chosen. Basically people choose between cash, credit, or check,  
> and then when they pick it will show a different div asking for more  
> information. Any ideas?

observe\_field or set the select’s onChange to a remote\_function ?

Fred
