Search code examples
xpagescustom-event

Platform Events


I cant make plaform event work. When in Chrome I cant see any request being made (but if I do XSP.PartialRefreshGet it works. Maybe I have a library version problem?). Here is the code.

<xp:button id="button1" value="ClickMe">
    <xp:eventHandler event="onclick" submit="false">
        <xp:this.script><![CDATA[XSP.publishEvent("publishString", "hello", "string");]]></xp:this.script>
    </xp:eventHandler>
</xp:button>
<xp:label value="Label" id="label1"></xp:label>
<xp:platformEvent id="platformEvent1" eventName="publishString">
    <xp:eventHandler event="onevent" submit="true" refreshMode="complete">
        <xp:this.action><![CDATA[#{javascript:if (context.getSubmittedValue() == null)     getComponent("label1").setValue("No value submitted");
else getComponent("label1").setValue(context.getSubmittedValue());}]]>
        </xp:this.action>
    </xp:eventHandler>
</xp:platformEvent>

PS: can someone upload uncompressed XSPClientDojo library please. It doesnt exist in domino directory for some reason.


Solution

  • publishEvent is part of the support for XPiNC (XPages in the Notes Client), alongside methods like XSP.executeCommand. They deal with integration with the Notes client specifically, so they're best to ignore when doing proper browser development.

    Dojo events are probably more what you're looking for: http://dojotoolkit.org/documentation/tutorials/1.7/events/