See if form has changed when user leaves the page

A

Alex

Hello everyone,

I'm sure a javascript exists to do this, but I'm having problems
finding it. If I have a form on a page, and any data on that form has
changed, I want the user to get a javascript pop-up telling them to
save the data before continuing. So if they're on the page, type in
the form at any place, and click say another tab or menu option without
saving, I want a message to appear to tell them to save before
continuing.

I've found these validation functions:
http://www.mattkruse.com/javascript/validations/

But I don't know if this'll do what I need as it appears to only
trigger when the user clicks Submit. I want the message to appear
whenever the user exits the page.

Thanks for any suggestions --

Alex
 
M

Martin Honnen

Alex said:
I'm sure a javascript exists to do this, but I'm having problems
finding it. If I have a form on a page, and any data on that form has
changed, I want the user to get a javascript pop-up telling them to
save the data before continuing. So if they're on the page, type in
the form at any place, and click say another tab or menu option without
saving, I want a message to appear to tell them to save before
continuing.

Some browsers (IE, recent Mozilla and Opera) support the onbeforeunload
event handler, it will trigger whenever some navigates away and ask the
user to confirm. See
<http://msdn.microsoft.com/library/d...hor/dhtml/reference/events/onbeforeunload.asp>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top