I do not need to create my own confirm dialog box. A confirm dialog box
is automatically built into the onBeforeUnload event by setting the
returnValue property of the event to a string. (I set the returnValue to
a string in my function that checks the value of the dirty flag). I need
to detect the cancel of this dialog box and then perform my function after
that, but I do not know how. Using if !confirm will not work in this case.
> If you're using confirm:
if(!confirm("Your question...")){
executeYourFuntion()
}
/Peter
> How do I detect if the cancel button has been clicked on the dialog box
> generated by the unBeforeUnload event? In my form, a flag is set anytime
> the user changes a field. If the flag is true when the unBeforeUnload
> event is triggered, I return a value so the the dialog box appears asking
> the user if they want to leave the page because changes have been made.
If
> the user clicks cancel, then I need to execute a function that resets
some
> of the form field values. The problem is that I don't know how to detect
> the cancel so that I can call the function. Can you please help?