In our solution we present to the user a logout label that he can click, to logout from the application. On the action of the logout label we call security.logout();
When he made changes and then press the logout button we ask him in a modal dialog whether he want to save or not. We open the dialog using application.showFormInDialog();
But in the WebClient, although before calling the security.logout(); we also call application.closeFormDialog(); to close the modal dialog, that dialog will never go away, unless the user close the browser completely.
Any suggestion how the dialog can be closed before the logout?
You can see in the below images. I press logout, it asks me to save. I choose NO. The only thing I do is to call security.logout(); I do nothing else!
[attachment=2]Screen shot 2011-07-08 at 11.44.42 AM.png[/attachment]
[attachment=1]Screen shot 2011-07-08 at 11.45.13 AM.png[/attachment]
Then I refresh the browser and I get this. The save window can’t be closed at all!
[attachment=0]Screen shot 2011-07-08 at 11.45.38 AM.png[/attachment]
How can I redirect to the login screen when user press logout?
that code should work in 5.2 as far as i know, there was a regression that in 6 we had that behavior back that when you close/logout a solution when in side a dialog it did close it there.
Much better is to use application.showUrl(url) or , application.showUrl(url,“_top”)
I’m doing this now, but I tested local on Windows(Chrome) and doesn’t work. Online, at least for me it worked on Windows(Chrome,Mozilla), but didn’t work on Windows(IE), Mac(Chrome,Safari).
function gotoLogout(event) {
var host = globals.getPreferencesFoundSet().server_host;
if (application.getApplicationType() == APPLICATION_TYPES.WEB_CLIENT) {
application.showURL("http://" + host + "/webclient.html", "_self");
}
security.logout();
application.closeSolution();
}
Before calling the above method I also call, to make sure that the modal dialog will close, but it doesn’t:
Because if I use “_top” or nothing it will open the login solution in a popup and the old page will remain as it is. If I use “_self”, after logout it will redirect in the same page to the login solution, and this is what we want.
thats weird that shouldn’t happen, “_top” should result in the current window that then the top is replaced with the url that you want.
I made a quick test in 6:
and for the SmartClient I do this. it might work also without the first 2 lines, but at least I had to put the solution name in the logout method, otherwise I get and exception and the app hangs: “cannot open solution”.