I have set for the onhide event of a dialog the following:
<xe:dialog id="dlgSelectYourItems">
<xe:this.onHide><![CDATA[
console.log('onHide dialog dlgSelectYourItems');
console.log('calling dialog dlgCard');
XSP.openDialog('#{id:dlgCard}');
]]></xe:this.onHide>
</xe:dialog>
In the browser console I see:
onHide dialog dlgSelectYourItems
calling dialog dlgCard
But no dialog is appearing.
If I check the source of my xpage:
<span id="view:_id1:_id237:cbMain:includeContent:_id4700:_id4823:_id4974:_id5039:dlgSelectYourItems" style="display: none" onHide="console.log('onHide dialog dlgSelectYourItems');
console.log('calling dialog dlgCard');
XSP.openDialog('view:_id1:_id237:cbMain:includeContent:_id4700:_id4823:_id4974:_id5039:dlgCard');" title="Select items"></span>
and
<div class="modal xsp-responsive-modal " tabindex="-1" role="dialog" aria-labelledby="view:_id1:_id237:cbMain:includeContent:_id4700:_id4823:_id4974:_id5039:dlgCard_title" id="view:_id1:_id237:cbMain:includeContent:_id4700:_id4823:_id4974:_id5039:dlgCard" widgetid="view:_id1:_id237:cbMain:includeContent:_id4700:_id4823:_id4974:_id5039:dlgCard" style="display: none; position: absolute; left: 920px; top: 633px;">
</div>
so it looks dialog dlgCard is available but it wont open.
What can be the cause?
//desperate Malin
First thing to check is that your second dialog actually works (use a button to test).
It probably does (but you should make sure) - and I guess that you might have been caught in the mysterious ways of events in XPages... There can be many reasons for issues but I find doing something like what you are trying sometimes just don't work because of the ways things work "underneath". I'm not the right person to try and explain that...
However, one thing I would try would be to "separate" the work. So you could try to put the code to open the second dialog on the e.g. button that closes the first dialog and put it in an oncomplete
event (which really is outside of the dialog that you close). You could use a viewScope variable to carry over any "state" that you need to control if/how to open the second dialog.
If that is too much of a rewrite for your code then you could also try to add the XSP.openDialog(...)
in a small setTimeout
(https://www.w3schools.com/jsref/met_win_settimeout.asp) just to decouple it from the events of closing the first dialog...
/John