I am using eventhandler on my Xpage to save my datasource (frmData):
<xp:eventHandler
id="saveEventHandler"
submit="true"
save="true"
event="calledbyid"
refreshMode="complete"
>
<xp:this.action><![CDATA[#{javascript:frmData.save();
context.redirectToPage("index.xsp")}]]></xp:this.action>
</xp:eventHandler>
This is called by custom properites:
<xe:basicLeafNode
onClick="XSP.executeOnServer('#{id:saveEventHandler}')"
label="Save"
rendered="#{javascript:currentDocument.isEditable()}"
>
</xe:basicLeafNode>
That is Mr. Jeremy Hodge code for client to server site trigger:
XSP.executeOnServer = function () {
// must supply event handler id or we're outta here....
if (!arguments[0])
return false;
// the ID of the event handler we want to execute
var functionName = arguments[0];
// OPTIONAL - The Client Side ID that you want to partial refresh after executing the event handler
var refreshId = (arguments[1]) ? arguments[1] : "@none";
var form = (arguments[1]) ? this.findForm(arguments[1]) : dojo.query('form')[0];
// catch all in case dojo element has moved object outside of form...
if (!form)
form = dojo.query('form')[0];
// OPTIONAL - Options object contianing onStart, onComplete and onError functions for the call to the
// handler and subsequent partial refresh
var options = (arguments[2]) ? arguments[2] : {};
// OPTIONAL - Value to submit in $$xspsubmitvalue. can be retrieved using context.getSubmittedValue()
var submitValue = (arguments[3]) ? arguments[3] : '';
// Set the ID in $$xspsubmitid of the event handler to execute
dojo.query('[name="$$xspsubmitid"]')[0].value = functionName;
dojo.query('[name="$$xspsubmitvalue"]')[0].value = submitValue;
this._partialRefresh("post", form, refreshId, options);
}
All fields value on the form has been save except one which is Rich text Item.
When I use simple button onclick event Instead of using above even handler, that Rich text Item saved!!
<xp:button
value="Label"
id="button1"
xp:key="facet_3"
>
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete"
>
<xp:this.action>
<xp:saveDocument
var="frmData"
>
</xp:saveDocument>
</xp:this.action>
</xp:eventHandler>
</xp:button>
Please let me know how to handle this event handler?
-mak