# Observe\_form should only react to changes in the form

**URL:** <https://www.ruby-forum.com/t/observe-form-should-only-react-to-changes-in-the-form/152607>\
**Category:** Rails\
**Created:** [November 5, 2008, 4:02pm UTC](https://www.ruby-forum.com/t/observe-form-should-only-react-to-changes-in-the-form/152607 "2008-11-05T16:02:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![morgler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e7dd6/32.png) [@morgler](https://www.ruby-forum.com/u/morgler)\
**Post date:** [November 5, 2008, 4:02pm UTC](https://www.ruby-forum.com/t/observe-form-should-only-react-to-changes-in-the-form/152607/1 "2008-11-05T16:02:30Z")

</div>

I have a problem with observe\_form:

\<%= observe\_form( “search\_form”,  
:frequency =\> 0.25,  
:update =\> “search”,  
:loading =\> “Element.show(‘spinner’)”,  
:complete =\> “Element.hide(‘spinner’)”,  
:url =\> { :action =\> ‘update\_search’ }) %\>

In my form I have a combo box. When the user clicks the combo box and  
scans through the options (WITHOUT yet selecting one), the controller  
action gets called by observe\_form. This is pretty annoying. What I  
intend is that the action is only called once the user really clicks  
on an option (thus changing the “model data” of the form if you want).  
How can I only react to “real” changes of the form and ignore  
everything else?

I already tried the “:on =\> ‘click’” option, but 1) this doesn’t seem  
to work and 2) it is a nasty workaround keeping the user from using my  
search form with a keyboard.

Any ideas?

---

<div class="post-metadata">

**Author:** ![morgler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e7dd6/32.png) [@morgler](https://www.ruby-forum.com/u/morgler)\
**Post date:** [November 10, 2008, 9:58am UTC](https://www.ruby-forum.com/t/observe-form-should-only-react-to-changes-in-the-form/152607/2 "2008-11-10T09:58:06Z")

</div>

morgler wrote:

> scans through the options (WITHOUT yet selecting one), the controller  
> action gets called by observe\_form. This is pretty annoying. What I  
> intend is that the action is only called once the user really clicks  
> on an option (thus changing the “model data” of the form if you want).  
> How can I only react to “real” changes of the form and ignore  
> everything else?

You should remove the :frequency option.

–  
Rails Wheels - Find Plugins, List & Sell Plugins -  
[http://railswheels.com](http://railswheels.com)
