This question is locked. New answers and comments are not allowed.
I have developed a plugin that checks for dirty fields on any attempt to navigate away from a form with changes. To do this I bind my own event to the $('a.t-window-action .t-close') element (among other potential nav items). The event hander checks to see if the form is dirty, and if it is it interrupts the closing of the Window and asks for confirmation (this is working). If the user selects cancel (meaning they don't want to close the window) I call the jQuery normalized stopImmediatePropagation method of the click event. This works for every link but the window close (X) link. So how do I cancel the Window close event?
Here's what my event handler looks like:
Any help will be greatly appreciated.
Cheers,
Jonathan
Here's what my event handler looks like:
var attemptNavigation = function(e) {
if (listener.checkForChanges()) {
if (confirm('Are you sure you want to abandon your changes?')) {
container.dirtyFormListener('destroy');
} else {
e.preventDefault();
e.stopImmediatePropagation();
}
}
}
Any help will be greatly appreciated.
Cheers,
Jonathan