How to rollback data from form when user just clicks the navigation to leave a page?

1
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?
asked
2 answers
3

Hi Stephen, 

Use Leave action widget: https://appstore.home.mendix.com/link/app/78474/

This widget accepts Microflow as a parameter. In the microflow, you can pass the object and rollback it. 

As far as my experience with the widget, it works in most of the cases. There are few corner cases, where it have some issues due to various browsers handle the browser events differently. 

May be you can find the corner cases and fix it my changing the widget yourself.

answered
1

To keep things simple, i always make sure the navigation menu is not available to the user while editing. So edit inside a blocking pop-up, or a page based on a pagetemplate without menu.

In this way the user is forced to choose either save or cancel before continuing.

answered