How to Implement an Unsaved Changes Warning Prompt in the Application Detail Screen?

0
Hi Mendix Community, I am working on a feature in my application where users should be notified if they have unsaved changes when attempting to cancel an action or leave the application detail screen. The goal is to improve usability and prevent accidental loss of data by providing a warning prompt.   Cancel button nonoflow Technical Feasibility: How can I reliably detect unsaved changes on the page in Mendix? Are there any performance considerations I should keep in mind?   I would appreciate any advice, examples, or insights into implementing this feature effectively in Mendix. Thanks in advance!
asked
1 answers
0

Hi there! Yes this is very easy to do if you know where to look!

 

You can use the beforeunload JavaScript event in the browser determine the behaviour on an navigation attempt.

 

You can integrate this JavaScript event with a Nanoflow by passing the nanoflow as logic to be executed to the function called by the event.

 

Please be aware that some browsers do not allow you to set your own message, but just specify behaviour to determine whether the event is allowed.

answered