Dirty page checking is scenario when you have a form, user does some modifications and before hitting the save button, tries to leave the page. Enterprise web applications have a requirement to intimate the user that "there are unsaved details" and "do you really want to move away from this page". The idea of solution behind this is 1. use of window.beforeunload and 2. use of onchange to register the window.beforeunload. As setting window.beforeunload manually for each control can be timeconsuming, we need a generic solution which will work with minimal code changes. If you search for this on internet, you will find the following generic code: <script type="text/javascript"> function setDirty() { window.onbeforeunload = showNavigateAwayMessage; } function clearDirty() { window.onbeforeunload = ""; } function showNavigateAwayMessage() { return "There is some unsaved Data in this form." } function setControlChangeEvent() { if (typeo...
Comments
Post a Comment