need to display warning before leaving application - Mendix Forum

need to display warning before leaving application


when a customer is trying to exit the application and they have not saved the information that was enter i need to

have a pop-up with the following message “Are you sure you want to exit? Your information will not be saved”

2 answers

Hey Robert,

I think this is what you’re looking for:
Or maybe this one:

Good luck!


Depends on how they are exiting the application. Turning of the computer gives you no chance. Closing the browser, should be possible since there are applications doing that, stackoverflow for instance (this forum does not :-( ). Try entering an answer there and close the page. You will see

But in Mendix there is no such thing as a page-event, which could trigger a microflow handling this.

I have checked the AppStore on ‘leave page’, ‘close page’ etc, but found nothing. You probably will need to do this using javascript:

// Warning before leaving the page (back button, or outgoinglink)
window.onbeforeunload = function() {
   return "Do you really want to leave this page and lose your unsaved changes?";

There is the “On Any Change“-AppStoreApp which you can use to trigger this javascript and there you will have it! Your page will ask you this question if you leave while having unsaved changes!