Florin M.
Florin M.

Reputation: 2169

xpages redirect to page and close current dialog

My button code :

    <xp:button value="Raport" id="button1" styleClass="lotusFormButton"
                            style="float:right;">
                            <xp:eventHandler event="onclick"
                                submit="true" refreshMode="complete" immediate="false"
                                save="true" id="eventHandler2">
                                <xp:this.action><![CDATA[#{javascript:context.redirectToPage("export_hidden.xsp");
getcomponent('exampleDialog').hide()}]]></xp:this.action>
                            </xp:eventHandler>
                        </xp:button>

It just go to the export_hidden.xsp ( XAgent for creating an excel file ) but without closing the dialog.

I tried reverse the 2 actions, but same results.

I appreciate your time.

Upvotes: 1

Views: 837

Answers (3)

Bob Yesenskiy
Bob Yesenskiy

Reputation: 414

Doing the CSJS with partial update on the dialog box, along with context.redirectToPage(xAgentName) will work, Domino 9.0.1 FP9.

Upvotes: 0

Per Henrik Lausten
Per Henrik Lausten

Reputation: 21709

Add a client-side call to XSP.closeDialog('#{id:exampleDialog}') in the onComplete event of the eventHandler.

Upvotes: 6

Fredrik Norling
Fredrik Norling

Reputation: 3484

If I understand you correctly you want to send an attachment to the user but remain on the same page. and after the attachment is delivered close the dialogbox.

the problem above is that your code tries to do two things at once. both clse the dialog and deliver the attachment. That isn't possible.

I see two solutions I would try.

  1. Remove the getcomponent('exampleDialog').hide() and execute that thru a button onclick on a second hidden button in the oncomplete event.

  2. If that don't work, set the url to the export_hidden.xsp in an hidden iframe in your dialogbox and also do a on button click on a hidden button the closes the dialogbox

Upvotes: 0

Related Questions