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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture on save event to disable onbeforeunload event

Status
Not open for further replies.

SarahMH

MIS
May 16, 2003
28
0
0
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????
 
My Save function is in vbscript so doesn't recognise the { -please suggest?
 
Thank so much feherke - I have done it by just removing the 'window.' and it works !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top