prompt for save with CF/ Javascript

by anottingham(at)topazti.com (Amy Nottingham)

 Date:  Tue, 6 Feb 2001 12:09:59 -0600
 To:  "HWG techniques" <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
Hello,

I am working on developing a web application with a combination of Cold
Fusion and JavaScript.  The problem we're having is that when a user is
filling out the form fields, they have to hit an "Update" button that saves
their changes to the database.  If they leave the page in some fashion,
whether clicking a link, hitting Back, closing the window, whatever, without
updating they will lose all the data they entered.

We would like to be able to prompt the user to save/update data if they do
something that will cause another page to load.  Our problem is that we can
handle events that occur within the application (like a link or button), but
cannot do anything to prompt them if they hit "Back" or close the window
using the X button.  We thought we could use the onUnload event, but all the
javascript books caution that onUnload should not be used to invoke anything
that depends on data about to be cleared from the page, and specifically
mention not using it to prompt a user.

Anyway, has anyone found a way around this? We have reached our wits end,
and are wondering if this is just a limitation we have to deal with in this
environment...

Thanks for all ideas and suggestions in advance.  If the solution is too
long or not appropriate for the list, please reply to
anottingham(at)topazti.com.

Amy

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA