See if form has changed when user leaves the page

Discussion in 'Javascript' started by Alex, Dec 28, 2006.

  1. Alex

    Alex Guest

    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
     
    Alex, Dec 28, 2006
    #1
    1. Advertising

  2. Alex wrote:

    > 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/default.asp?url=/workshop/author/dhtml/reference/events/onbeforeunload.asp>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 28, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MSFT
    Replies:
    0
    Views:
    419
  2. Jorge_Beteta
    Replies:
    4
    Views:
    8,763
    Shiv Kumar
    Jan 12, 2004
  3. Tory

    Capturing event when user leaves a cell?

    Tory, Apr 21, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    119
  4. Mike Dee
    Replies:
    0
    Views:
    383
    Mike Dee
    Mar 2, 2006
  5. windandwaves
    Replies:
    4
    Views:
    152
Loading...

Share This Page