Exit webclient from application.showFormInDialog

Can webclient be exited from a application.showFormInDialog?

The following code does not work:

currentcontroller.saveData();
application.closeFormDialog('exitdialog');
application.exit();

It brings up a browser dialog that says:

Are you sure you want to navigate away from this page? Reloading this page will cause the modal window to disappear. Press Ok to confirm or Cancel to stay on the current page.

Dean

When you pop a dialog the actual pop MUST be the last line. So you can’t code an exit after the pop in that same method. The pop form could have an onshow method that exits perhaps.

From within a webcient FormInDialog I tried the following:

forms.myexitform.controller.show();

with application.exit() as the onshow method of myexitform. At first it appeared to work, but now that I have tried it a few more times I see that it does not work consistantly. I will try a few more variations.

Dean

Hi Dean,
exiting the session from within the FID has some drawbacks: whatever URL you want to load after the session is closed will be loaded INSIDE the FID, so if you are using a modal FID this is not the way to go.

I have a similar problem.
Unfortunately there was no clear solution for the original topic.

I have a situation that I also have done a popup

application.showFormInDialog(forms.webshop_punchout_confirmation, null, null, null, null, 'Punchout', false, false, 'confirm', true)

Now a screen is shown where confirmation is asked.
If users replies ‘YES’ then some action must be done and the application must be quited. I that case I want the user to see some internetpage:

So my method onYes is as follows:

//
// Do some methods
//
application.closeFormDialog();

application.showURL('http://www.post.be/', '_self');

security.logout()  // perhaps the logout must be before showURL???

The problem is, that the internet page (www.post.be) is shown in the dialog form and not in my original browser.

And different from the smartclient, in the webclient after the

application.showFormInDialog

all code is executed directly. So putting this code after the application.showFormInDialog() is no option as well (like Jan already replied).

Is there some action that is triggered on my main form when Dialog is closed? I tried to see of onShow is executed again, but that is not the case (even when I do controller.show() again). There is also not a onFocusGained for a form, so that is also not possible.

Anyone has a good idea?

I tried to put an extra form that will be called. This form shows only message that the order has been completed:

application.closeFormDialog();

//	If written to the database, then status =2 
if (_to_webshop_session.record_status == 2)
	forms.webshop_finished.controller.show()

That works, but now I also want to logoff the user. while this screen remains visible.

So I thought in the onShow of my form new to do a logout

// forms.webshop_finished.onShow()

security.logout();

But that removes the form, which I don’t want and gives me a message about redirect. Is there a solution for?

Unfortunately webclient again doesn’t react like expected.

What a hell! :(

The loading of the URL inside the Modal FID, instead of in the main window is being investigated.

Paul

Even this

application.closeFormDialog();

//   If written to the database, then status =2
if (_to_webshop_session.record_status == 2)
   forms.webshop_finished.controller.show()

is not working. It is not a URL that I’m calling.
Some message about leaving the page (see screenshot)

This means that there is no way that you can move to another form on leaving the dialog :-(
So there is 1 solution left, replacing the dialog by a full screen form

martinh:
So there is 1 solution left, replacing the dialog by a full screen form

Yes, for the time being this is the only available solution.
Let’s see what dev team will pop out of their magic cap…

Closing the FID and in the same method showing another form works fine for me.

Are you sure this doesn’t work? If so, please create a testcase and file it in out support system.

Paul

It works in smartclient, not in webclient.
I’ll try to make a small sample case