How to raise warning before closing WebUI tab?

  • 8 October 2020
  • 1 reply

  • AIMMS Implementation Partner
  • 0 replies

Hi All,

For a project we are implementing a user is making changes to a relatively large table. The user has the possibility to store these changes in a database.

However, when a user closes his/her browser after having made these changes and forgets to store the changes in the database the changes have to be made all over again. Is there a way to raise a warning when closing the browser? In this case that would refer to a user that has made changes, but has not stored them in the database.

I know using a uponleave procedure works when navigating to a different page, however when closing a tab no warning is raised using such a uponleave procedure. Furthermore, I have seen multiple sites raising a warning when closing the tab, so curious to see if this is possible to do in the AIMMS WebUI as well!



Best answer by MarcelRoelofs 9 October 2020, 11:20

View original

1 reply

Userlevel 4
Badge +5

Obviously, there are more scenarios to consider where the connection to a webui app gets closed than just closing a browser tab, e.g. the user closes the browser altogether, laptop battery drained, BSOD, …


Therefore, shouldn’t you rather consider protecting against lost edits inside the model? There are at least two options that come to mind without even thinking this through very thoroughly:

  • The WebUI has an option to save a case when the backend session terminates, and open that case the next time a new webui session opens. You could also setup a similar scheme by coding this in PreMainTermination & PostMainInitialization yourself, where you have the option to better control when you want to trigger the use of such a mechanism.
  • Use CDM to automatically store user edits as soon as they are done. This would also allow undoing changes based on the history. As a bonus, CDM would allow multiple users to make changes to the data in a consistent way. 

Hope this will give you sufficient ideas to continue.



Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator