# Ajax killed my observe\_field

**URL:** <https://www.ruby-forum.com/t/ajax-killed-my-observe-field/106182>\
**Category:** Rails\
**Created:** [June 7, 2007, 6:58am UTC](https://www.ruby-forum.com/t/ajax-killed-my-observe-field/106182 "2007-06-07T06:58:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [June 7, 2007, 6:58am UTC](https://www.ruby-forum.com/t/ajax-killed-my-observe-field/106182/1 "2007-06-07T06:58:00Z")

</div>

I have a page that has a text field on it which in turn has an  
observe\_field hooked up to it. As the user types in the field, a list  
of items on the page gets filtered by that entry. This all works fine.

On the same page, I also have a hidden div that sometimes gets ajaxed  
into view using the following:  
def add\_item\_to\_list  
render :update do |page|  
page[‘item\_name’].value = ‘’  
page.visual\_effect :appear,‘add\_item\_panel’, :duration =\> 0.5  
page[“item\_name”].focus()  
end  
end

User types in this newly visible text field and then hits an ajax done  
button which “un-appears” the add\_item div.

Now that that div is gone, the filter field mentioned at the beginning  
of this post no longer makes the observe\_field action happen. You can  
type stuff in that field, and it has focus etc. Acts normally in all  
ways except that it no longer seems to have an observe\_field hooked to  
it.

The “hidden” div has a form\_remote\_tag in it to enable the use of the  
add\_item text field. I’m guessing that this other form coming into play  
is hosing up the observe field for the original form on the main page.

Any ideas?

thanks,  
jp

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [June 7, 2007, 2:19pm UTC](https://www.ruby-forum.com/t/ajax-killed-my-observe-field/106182/2 "2007-06-07T14:19:16Z")

</div>

Have you used Firebug to see what it tells you?

Cheers,  
Zach I.  
â†’ Blog – [http://www.zachinglis.com](http://www.zachinglis.com)  
â†’ Company – [http://www.lt3media.com](http://www.lt3media.com)  
â†’ Portfolio – [http://portfolio.zachinglis.com](http://portfolio.zachinglis.com)

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [June 7, 2007, 4:39pm UTC](https://www.ruby-forum.com/t/ajax-killed-my-observe-field/106182/3 "2007-06-07T16:39:26Z")

</div>

Zach I. // LT3media wrote:

> Have you used Firebug to see what it tells you?

Thanks Zach. So far I’ve only used FireBug for solving CSS problems.  
What should I look for to solve an issue like this one? By using  
logger.info I’ve already determined that the observe\_field is not  
kicking the action when something is typed. Don’t know what to look  
for.

Is there a good article somewhere about debugging with Firebug?

thanks,  
jp
