When the form is edited, unsaved turns true. When submit-button is clicked a onbeforeunload is fired, which will fire an alert unsaved warning, which we don't want when submitting form. So we need to set unsaved to false, so that there is no unnecessary warning.