SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I stop observe_form on a form?

    I'm using observe_form helper to monitor a form and auto save every minute. This is working well. However, when the form is saved by the user, the form is removed via AJAX call. Even though the div area, where both the form and observer were in, was removed the observer routine is still observing and throws a nasty error message because it can't find the form it was observing!

    I'd like to avoid refreshing the whole page and keep my AJAX.

    Any ideas? I've been searching around and can't find anything addressing this problem.

  2. #2
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The prototype call you're looking for is "stopObserving" to shut down the observer before you get rid of it.

    stopObserving( element, name, observer [ , useCapture ])

    Removes an event handler named name from element. observer is the function reference (not an anonymous function). If useCapture is true, the event is handled in the capture phase; if false it's handledin the bubbling phase. Returns element.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •