javascript - XPages events onStart and onComplete in conjunction with dojo.connect -
i use xp:eventhandler
events onstart
, oncomplete
in conjunction dojo.connect
.
take @ code snippet:
<xp:scriptblock id="scriptblock1"> <xp:this.value><![cdata[ dojo.connect(dojo.byid("#{id:btnsubmit}"), "onclick", callbackonclick); dojo.connect(dojo.byid("#{id:btnsubmit}"), "oncomplete", callbackoncomplete); function callbackonclick() { alert("onclick works!!!"); } function callbackoncomplete() { alert("oncomplete works!!!"); } ]]></xp:this.value> </xp:scriptblock> <xp:button value="submit" id="btnsubmit"> <xp:eventhandler event="onclick" submit="true" refreshmode="norefresh"> <xp:this.action><![cdata[#{javascript:// on server side}]]></xp:this.action> <!-- <xp:this.oncomplete><![cdata[alert("oncomplete");]]></xp:this.oncomplete>--> </xp:eventhandler> </xp:button>
dojo.connect
works perfect onclick
-event doesn't work oncomplete
-event?
thanks in advance answer.
while onclick
real browser event (which can connected dojo), oncomplete
event provided xsp object of xpages only.
when looking generated html code (uncommented out oncomplete event of example), can see it's code converted string (second last parameter):
xsp.attachpartial("view:_id1:_id2", "view:_id1:btnsubmit", null, "onclick", function(){}, 2, "@none", null, "alert\u0028\u0022oncomplete\u0022\u0029;", null);
this string evaluated when xsp._partialrefresh method finished.
that's why can't use dojo.connect
here.
Comments
Post a Comment