> >     I want to attach an event on close to verify that all changes made
> >     on a form are saved.

We are doing thins with jquery .unload() and it works. We don't stop people
from leaving, but just ask, before, if they wish to submit unsaved changes
(and save them with a .load() if they answer "OK").

The code is quite complex, because it's doing lots of things, but hey, it's
free
http://zone.spip.org/trac/spip-zone/browser/_plugins_/_stable_/crayons/javascript/crayons.js

300         jQuery(window).unload(function(e) {
301           var chg = jQuery(".crayon-changed");
302           if (chg.length && uniConfirm(configCrayons.txt.sauvegarder)) {
303             chg.next().find('form').submit();
304           }
305         });

uniConfirm() is just a unicode-safe version of confirm()
jQuery(".crayon-changed") is the list of unsaved items, and their associated
forms are jQuery(".crayon-changed").next()

-- Fil


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to