...this is a little off the beaten path, but I'd like to be able to pass a parameter and process it on the server side using SSJS.
Specifically, I have some client side javascript code that is currently calling a custom event handler:
<xp:inputRichText id="inputRichText1">
<xp:eventHandler id="saveMyDoc" event="onfubar" submit="true" refreshMode="partial" refreshId="inputRichText1" execMode="partial">
<xp:this.action><![CDATA[#{javascript:
mydoc.save();
}]]></xp:this.action>
</xp:eventHandler>
<xp:this.value><![CDATA[#{javascript: mydoc.getItemValue("description")}]]></xp:this.value>
</xp:inputRichText>
...and I am using custom client side javascript to call the "saveMyDoc" eventHandler, like so:
executeOnServer('saveMyDoc');
...which wraps around client side XSP._partialRefresh - and this successfully calls "mydoc.save()" on the server, but what I need to do is pass some text data to save as well.
I see that the XSP._partialRefresh, which looks like (found in xspClientDojo.js.uncompressed.js):
this._partialRefresh = function x_prfh(method, form, refreshId, options)
...permits a options.params value to be passed with it, but does anyone know how to access this on the server side with SSJS?
Many many thanks in advance! (I've searched and searched and am stumped!)
Cheers,
Alex
PS - The "executeOnServer" was copied from Jeremy Hodge's excellent
blog post:
var 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]) ? XSP.findForm(arguments[1]) : 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] : {};
// Set the ID in $$xspsubmitid of the event handler to execute
dojo.query('[name="$$xspsubmitid"]')[0].value = form.id + ':' + functionName;
XSP._partialRefresh("post", form, refreshId, options);
}