Monday, August 27, 2012

Prevent window from closing on Save and Close.



function OnSave(event) {
         // Cancel the save operation.
         event.returnValue = false;
         return false;
}
or
function OnSave(event) {
        // Cancel the save operation.
        event.getEventArgs().preventDefault();
        return false;
}
My understanding is that event.returnValue = false; is CRM 4.0 syntax (still works in CRM 2011), while event.getEventArgs().preventDefault(); is CRM 2011 syntax

Note: The pass execution context as first parameter checkbox is very important to this process. Without it, it will not work.

No comments:

Post a Comment