Rollback changes when user leaves page without saving/cancelling

Hi, I have a similar question to this question asked earlier. When you have a form that is editing data, what is the best way to rollback that data when the user just decides to navigate away from the page using the menu navigation? So the user clicked to edit a record, they have updated the data, but now decide to click on a different page in the menu before cancelling or saving the record.  In this instance, the data should not be saved or used as the user decided to just leave the page.  Instead though, Mendix is keeping that data so if the user goes back to the page it has their changes. Is there an easy way to prevent this data from remaining around and instead get rid of the changes the user had entered?   The accepted solution there suggested to use Leave action widget: But it looks like the widget is not available anymore. What is the alternative to this widget that would solve this issue? Thanks
2 answers

1) dont have a navigation menu on an edit page

2) use a non-persistent object to enter the data, and only copy that to the persistent object in the save flow. That way you never have to worry about the dirty state of an object.


I provided the option in the other forum question, but I myself have been searching for that widget for some time.

Looks like the development team had chose to discontinue.

You could also develop a similar Javascript action or widget which could track

- Browser refresh

- Navigate from one page to another

- Browser close action etc

However, if you are saving the state of the object when the editing is in progress for showing some dependent reference selector then it will be difficult to revert with leave action widget or similar thing. In that case you could follow Lennart’s suggestion. The only problem however is, implementing the same pattern across the application and probably having duplicate NPE’s with same schema.