On Dialog Close

In web client I have a dialog which I open and the user can then update info on another form.

Problem is the user can exit the dialog by clicking on the cross top right corner, is there a way to detect this so I can reverse any changes they made elsewhere or alternatively remove the cross so I can add my own button which they are forced to click which I can then run my code.

I tried the onunload but that is not triggered.

hi ffow,

use the onHide trigger.
the onUnload trigger is only used whenever a form is removed from the Servoy cache.

hope this helps

Not sure if I’ve done this correctly. In the 2nd form that is started by a showforninDialog I added the onHide however it is not triggered when I click the cross top right corner… the form simply closes without a trigger.

Just to clarify this is web client.

What version of Servoy are you running?
Is that a modal/non-modal dialog? Is it actually a separate browser window/tab that the user is closing?

Am running 5.2.1

The form that the user closes was opened by the by the following piece of code, I have the onHide in the frm_tasks form :

application.showFormInDialog(forms.frm_tasks,-1,-1,-1,-1,'Appointments',false,true,'Appointments',true)

Tried it with 5.2.10 but it seems to work there.
Are you sure that the onHide event is registered to the correct form?

Hmm realised theres a bit of a chain of forms.

Basically the chain goes like this, Form A is started from the globals onOpen when the solution starts. It is started from this method as :

application.showFormInWindow(forms.A,-1,-1,-1,-1,'A,false,true,'A)

The Form A then subsequently starts Form B via a :

application.showFormInWindow(forms.B,-1,-1, -1,-1,'B,false,true,‘B’)

Form A is then closed

Form B then has a tabpanel with another form, say Form C within the tabpanel. This form C issues the openForminDialog of the frm_tasks which I pasted above.

The frm_tasks has the onHide

Is the onHide event registered to “frm_tasks”?
Is the closing of “frm_tasks” the action that you want to intercept?

yes

Just rebooted and its now working …

I was going to say that this is working as well (for me).

The thing is, when closing browser windows you won’t get notified of hide - because that is tricky to detect.
So for example if you close form B (that is an actual browser tab/window that contains the frm_tasks dialog) then no hide event will be triggered.