Setup:
I have a form and a "Submit" button. Ideally the user should fill out the form, click "Submit" and then leave the tab. If he tries to leave the tab without saving the changes, I need to alert him with 3 options:
- Save
- Discard: discard the form data changes, and leave the tab, as if the data was never modified. If user comes back to the same tab, he should see the "unmodified" data.
- Cancel: Just dismiss the dialog box, keep the user on the same tab. User can either modify the data further, click save, etc.
Problem:
Implementing Save and Cancel is easy. The issue is with "Discard". If the user clicks "Discard", the form data should get restored to what it was before modification.
Is there any way to do this? If I haven't explained issue properly, please let me know.