Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > save form data when leaving page without submit

Thread Tools

save form data when leaving page without submit

Marco Alting
Posts: n/a

I have an HTML form which enters data in an Access database using ASP. But
now my client asked me if it is possible to alert users, when they click a
link other then submit on the page, that there is unsaved data and if they
want to save. If so the page must redirect to the ASP page that writes the
data and then go to the page that they click and if not the page should be
redirected to the link they clicked.

I tried using the onUnload and onBeforeUnload events, but gives me no result

I hope someone can help

Reply With Quote
Dave Vick
Posts: n/a


When the onUnload event is triggered it is already too late, the page is
already in the process of being unloaded. About the only thin I can
think of would to have all of your links call a confirming function, pop
up a confirm box and then, based on their answer, either stay there or
follow the link. Even then there is the back button, their favorites
list and just plain old closing the browser. Your never going to be able
to cover all of the possiblilites, no matter what type of application it
is and a web app is even harder. Just make it as robust as possible and,
most likely, after they've done it once, they wont leave it again with
out saving

The onBeforeUnloadEvent is MS specific I think only for their JScript.

Hope that helps a little

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
submit 1 form to 2 servers or 2 forms to 2 server (1 form each) on 1 submit Javascript 3 06-23-2007 07:29 AM
how to automatically "Save " a page after certain intervals without clicking "Save Page As..." subhadip Java 0 03-28-2007 04:15 PM
submit the form data to the popup window without a submit button Javascript 2 01-01-2005 06:07 AM
submit the form data to the popup window without a submit button HTML 2 01-01-2005 06:07 AM
Warn to Save before leaving a page... Jamie Jackson Javascript 5 10-10-2003 07:58 PM