rice-framework/krad-web/src/main/webapp/krad/scripts/krad.dirty.js
/**
 * The DirtyFormState constructor sets up the beforeUnload event that checks for dirtyness when the user tries to
 * leave the page through a browser based method (back, url, refresh, close, anchor not in krad scope)
 *
 * @constructor
 */
The DirtyFormState constructor sets up the beforeUnload event that checks for dirtyness when the user tries to
leave the page through a browser based method (back, url, refresh, close, anchor not in krad scope)

@constructor
The DirtyFormState constructor sets up the beforeUnload event that checks for dirtyness when the user tries to leave the page through a browser based method ( back url refresh close anchor not in krad scope ) @constructor
function DirtyFormState() {
    var dirtyFormStateObject = this;
    jQuery(window).bind('beforeunload', function (event) {
        var methodToCall = jQuery("[name='methodToCall']").val();
        if (!methodToCall) {
            var dirty = dirtyFormStateObject.checkDirty(event, false);
            if (dirty) {
                return getMessage(kradVariables.MESSAGE_KEY_DIRTY_FIELDS);
            }
        }
    });
}
function DirtyFormState ( ) { var dirtyFormStateObject = this ; jQuery ( window ) . bind ( 'beforeunload' , function ( event ) { var methodToCall = jQuery ( "[name='methodToCall']" ) . val ( ) ; if ( ! methodToCall ) { var dirty = dirtyFormStateObject . checkDirty ( event , false ) ; if ( dirty ) { return getMessage ( kradVariables . MESSAGE_KEY_DIRTY_FIELDS ) ; } } } ) ; }
The DirtyFormState constructor sets up the beforeUnload event that checks for dirtyness when the user tries to
 leave the page through a browser based method (back, url, refresh, close, anchor not in krad scope)
The DirtyFormState constructor sets up the beforeUnload event that checks for dirtyness when the user tries to leave the page through a browser based method ( back url refresh close anchor not in krad scope )
// make sure form doesn't have any unsaved data when user clicks on any other portal links,
 // closes browser or presses fwd/back browser button
 // methodToCall check is needed to skip form posts
 // prompt does not come through in checkDirty since we are unloaded, so we
 // need to return the question
