Capture when the user exits the xe dialog:

I need to do some cleanup when the user exits the xe: dialog. I put the code in the onUnload event as follows:

viewScope.remove("vsSomeVariable");
viewScope.remove("vsAnotherVariable");
etc;

but when userr clicks the "X" button in the dialog box, this code is not executed. I added some printing to console instructions in my code, and onUnload does not work when I think this should happen. it would seem that the sequence is onLoad, then onUnload, then the user does his thing, and if they press "X", onUnload does not appear. Is there a way to disable “X” in the xe dialog: so that I can create an “Exit” button that will do what I want, or capture a click on “X” so that I can complete my cleaning process?

+4
source share
1 answer

Add SSJS code in xe: dialog onHideor onUnloadevent:

<xe:dialog id="dialog1">
   <xe:this.onHide><![CDATA[#{javascript:print("onHide")}]]></xe:this.onHide>
   <xe:this.onUnload><![CDATA[#{javascript:print("onUnload")}]]></xe:this.onUnload>

But , make sure you put your code in All Properties

enter image description here

and not in Events

enter image description here

+4
source

All Articles