Detecting Pending Changes in ASP.NET MVC

1/22/2012

Please please do not do this. This is why people hate their software. It fixes a problem in the developer’s mind not in the user’s mind.

Here is the issue at hand. Say, user pulled up an entry form and made some changes. Then the above mentioned user clicked browser back button, navigating away from the current page, and thus loosing all the pending changes. A friendly software application should warn the user, shouldn’t it?

No no no no. The user took an action, respond and obey, especially with the sacrosanct back button of all things. Nagging them is never good. What if they want both; to go back and not lose there changes.

Let’s start with a better definition of the problem: The user clicks the back button while editing and could loose changes. How should the application respond. Let’s eliminate “Pop up a dialog box” as that is never the right answer. How about saving the state so if the user clicks the forward button to return to the page their data has not been lost. Most browsers will do this automatically and the users understand the flow.