POI 4 XPages - document generation works only once

Ok, to be honest: the headline doesn't tell the whole truth. I am using a custom control with several buttons (save, close, edit etc.) and a button that executes a POI action - it's generates a Word file. I experience a problem here: after hitting the POI-button my other buttons (and the POI one as well) won't work anymore, no click is triggered. Now the strange one: after waiting a few seconds (depending on which browser I use, Chrome is fastest) I am able to click the buttons (all of them) again so that I can e.g. leave (close) or edit my Xpage.

I don't know if that helps but here is the event code of my POI button:

<xp:button id="button5" styleClass="btn btn-sm printbutton"
            style="display:none">
            <i class="fa fa-print"></i>
            &#160;
            <xp:text>
                <xp:this.value><![CDATA[#{javascript:"Nach MS Word exportieren"}]]></xp:this.value>
            </xp:text>

            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action>

                    <xp:actionGroup>
                        <xp_1:generateDocument documentId="wordprint"
                            loaded="true">
                        </xp_1:generateDocument>
                    </xp:actionGroup>
                </xp:this.action>
            </xp:eventHandler>
        </xp:button>

Any ideas how to avoid this behavior or is it a bug in POI 4 XPages?

BTW: I am not able to execute another action right after getting the Word document, e.g. execute a script or open a page. That would be also an acceptable way to close the xpages after "printing".

Thanks in advance!


Oliver, add the client-side JS call XSP.allowSubmit() to your button in order to allow new submits after pressing the button:

<xp:button id="button5" styleClass="btn btn-sm printbutton" style="display:none">
        <i class="fa fa-print"></i>
        &#160;
        <xp:text>
            <xp:this.value><![CDATA[#{javascript:"Nach MS Word exportieren"}]]></xp:this.value>
        </xp:text>

        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action>
                <xp:actionGroup>
                    <xp_1:generateDocument documentId="wordprint"
                        loaded="true">
                    </xp_1:generateDocument>
                </xp:actionGroup>
            </xp:this.action>
            <xp:this.script><![CDATA[XSP.allowSubmit()]]></xp:this.script>
        </xp:eventHandler>
    </xp:button>

I believe the issue is you're generating the word document from the button on the same page.

Do the generation from an XAgent. Have the button call the XPage containing the XAgent and you should be fine.