4

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!

2 Answers 2

14

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>
1
  • Thanks Per, brilliant solution. I will add it to the Example DB in the next release. I've you have any idea, how I can do the same behaivor in the backend, let me know. But I think thats not possible. Sep 26, 2014 at 10:26
2

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.

1
  • Yes, and another approach would have been to use the URL instead. Thanks, mate! Feb 21, 2014 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.