Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onbeforeunload capture if save button has been clicked

Status
Not open for further replies.

SarahMH

MIS
May 16, 2003
28
GB
Can anyone help - on the edit screen I need to prompt the user if they try to exit without clicking the save button.

The save button validates the data and if ok submits the form calling another .asp page which writes the data to a sql database.

I have used the 'onbeforeunload' javascript event and that prompts the user - if they click cancel they are returned to the screen to save their work.

The problem is that when they click the save button the prompt also appears and they have to click ok before the data is saved (which will be really tedious).

I need to somehow capture this even and not fire the onbeforeunload event if the save button has been pressed - I have no idea how this can be achieved - can anyone suggest????

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top