Ajax killed my observe_field

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

Have you used Firebug to see what it tells you?

Cheers,
Zach I.
→ Blog – http://www.zachinglis.com
→ Company – http://www.lt3media.com
→ Portfolio – http://portfolio.zachinglis.com

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs