# Observer Form

**URL:** <https://www.ruby-forum.com/t/observer-form/137993>\
**Category:** Rails\
**Created:** [May 19, 2008, 11:28am UTC](https://www.ruby-forum.com/t/observer-form/137993 "2008-05-19T11:28:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [May 19, 2008, 11:28am UTC](https://www.ruby-forum.com/t/observer-form/137993/1 "2008-05-19T11:28:24Z")

</div>

I have a form observer wich posts back a form correctly, however, i need  
to know which item caused the form observer to trigger and what the  
value of that field is. At the moment i get the whole form back but  
dont know which field triggered the call back.

\<%= observe\_form(‘test’,  
:on =\> ‘click’,  
:url =\> {:controller =\> ‘test’, :action =\> ‘test’},  
:before =\> “Element.show(‘imgSpinner’)”,  
:success =\> “Element.hide(‘imgSpinner’)”) %\>

JB

---

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [May 19, 2008, 12:17pm UTC](https://www.ruby-forum.com/t/observer-form/137993/2 "2008-05-19T12:17:15Z")

</div>

Ye thats what i would normally do but im having an issue where the field  
observer will only work once and then wont trigger again. Ive found  
away around that issue but was wondering if there was an easy way to  
submit the form but als the element that has triggered the form event.

Ryan B. wrote:

> How many fields are you monitoring in this form? It may be worth while  
> to  
> have it using observe\_field rather than observe\_form, because that  
> should be  
> able to pass in what the name of the element is that triggered it.
> 
> On Mon, May 19, 2008 at 6:58 PM, John B. \<  
> removed\_email\_address@domain.invalid\> wrote:
> 
> > ```
> > :success => "Element.hide('imgSpinner')") %>
> > 
> > ```
> > 
> > ## JB
> > 
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > >
> 
> –  
> Appreciated my help?  
> Reccommend me on Working With Rails  
> [http://workingwithrails.com/person/11030-ryan-bigg](http://workingwithrails.com/person/11030-ryan-bigg)

---

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [May 19, 2008, 11:47am UTC](https://www.ruby-forum.com/t/observer-form/137993/3 "2008-05-19T11:47:55Z")

</div>

How many fields are you monitoring in this form? It may be worth while  
to  
have it using observe\_field rather than observe\_form, because that  
should be  
able to pass in what the name of the element is that triggered it.

On Mon, May 19, 2008 at 6:58 PM, John B. \<  
removed\_email\_address@domain.invalid\> wrote:

> ```
> :success => "Element.hide('imgSpinner')") %>
> 
> ```
> 
> ## JB
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Appreciated my help?  
Reccommend me on Working With Rails  
[http://workingwithrails.com/person/11030-ryan-bigg](http://workingwithrails.com/person/11030-ryan-bigg)
