sailensd1 / jquery-plugin-form-navigation-confirmation

Automatically exported from code.google.com/p/jquery-plugin-form-navigation-confirmation
0 stars 0 forks source link

"'undefined' is null or not an object" error on navigating away with no unsaved changes on IE7 #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open the form and make no changes (so should not trigger warning)
2. Hit a hyperlink on the page or close the browser tab

What is the expected output?
* Navigating away from the form succeeds

What do you see instead?
* Javascript error: 'undefined' is null or not an object
* Navigation away from the form occurs thereafter

What version of the product are you using? On what operating system?
* Version 1.1 of FormNavigation
* Windows XP

Please provide any additional information below.
* Note: There may be better ways to fix this (such as using jQuery in another 
another Defect answer. However this proposed fix has currently been tested on 
FireFox 3 and IE7).
* You can fix it by making the following change in jquery.FormNavigate.js 
from...

        function confirmExit( event ) {  

            if (global_formNavigate == true) {  event.cancelBubble = true;  }  else  { return message;  }

        }

... to ...

        function confirmExit( event ) {  

            if (global_formNavigate == true) {

                // Note: event is undefined in IE7

                if (event == undefined) { event = window.event; }

                event.cancelBubble = true; 

            }  else  {

                return message;

            }

        }

Original issue reported on code.google.com by decla...@gmail.com on 7 May 2011 at 10:20