onsubmit called even when cancel button hit in onbeforeunload

C

cgrohowski

I have a script that detects form changes and, if detected, fires off
a return value for the pages onbeforeunload event to show a dialog to
the user confirming that they really want to leave the page (this
project is IE6+ only). I also have an onsubmit event that disables
buttons on a submit so the user does not click buttons twice (this
causes havok in JSF). When the user is presented with the
onbeforeunload dialog and hits cancel, the onsubmit method is *still*
called, even though the form wasn't truly submitted. I have searched
high and low for a solution, or a way to tell what button was pressed,
but have found nothing so far. Has anyone run into a similar
situation and have a solution or a place to look for one? Any help is
much appreciated.

Thanks,
Charles
 

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,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top