I have a webpage that has a form with a user's profile on the page. The user can edit his profile and save by clicking on the save button. What I want to do is have it so that if he leaves the page but has made changes to his profile, it will do either of two things:
1) A pop-up box will state "Changes have been made, are you sure you want to exit?". If the user clicks "yes" then it will continue redirecting to the page he was leaving to. If he clicks "no" then it cancels his redirection and stays on the page with all the form data not changing.
My form HTML code looks like:
<form name="test" method=post action="http://localhost/servlet/test.savedata
<input type=text name=name value="test name">
<input type=text name=email value="test email">
<input type=submit name=save value="Save">
This pop-up must only occur if the data in the form has changed from the original values. I understand that perhaps this process flow might not be possible, if so, a suitable workaround that provides the same "warning" to the user would be most helpful. Oh and the solution must work in Netscape and IE (other browsers too if possible). Thanks!