Advertisement

07.22.2008 at 01:16PM PDT, ID: 23586446 | Points: 500
[x]
Attachment Details

call a function before windows.onbeforeunload event triggers

Asked by jagadeesh_motamarri in JavaScript, JavaScript Frameworks

Hi Experts -

The idea is to check if the form is dirty and display a confirm dialog box to the user to save the page before navigating away....i'm done with 99% of this task using Jquery.

here is the last piece...

Now i need call a function ( callThisAtLast() ) after the user clicks on "OK" confirm dialog box and just before the page unloads...how do i achieve this?

Here is the sample snippets that prompts the dialog box.

Thanks
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
function callThisAtLast(){
 
;;;;;
 
 
}
 
window.onbeforeunload = confirmExit;
 
function confirmExit(){
      if (verifyIfFormChanged== true ){
	if ( formIsChanged == true ){
	   return "        !!! You have unsaved data on this page !!!";
	}else{
	  if (checkOthers()) {
          
          }else{
	    return "        !!! You have unsaved data on this page !!!";
          }
	} 
     }
}// end of confirmExit()
 
Loading Advertisement...
 
[+][-]07.22.2008 at 04:57PM PDT, ID: 22064792

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:22AM PDT, ID: 22072256

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 01:45PM PDT, ID: 22073654

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628