Jeremy Hodge, Jun 27, 2010 3:18:09 PM
I make extensive use of the XSP object's partialRefreshGet and partialRefreshPost functions to invoke interactions with the Domino XSP server. It's generally accepted that a Get is faster than a Post because there is no data updating to do, no data to collect etc.
But sometimess, I need to send a single transient value up to the server to influence the returning results. You can do this on a get through the combination of a params object in the options object sent to the partialRefreshGet, and then using context.getSubmittedValue() in your Server Side JavaScript.
To do this, you call XSP.partialRefreshGet() just like has been illustrated before, but you add a new object to your options object, called params. You'll want to add a name/value pair to the params object with the name $$xspsubmitvalue, and the value of your choice.
Fully coded, it would look like something like this:
(client side javascript code)
var refreshId=dojo.query('[id$="serverSideIdYouWantToRefresh"]')[0];
var mySubmitValue='whatYouWantToSendHere';
XSP.partialRefreshGet(refreshId, {
params: {
'$$xspsubmitvalue': mySubmitValue
},
onStart: function () {
alert('starting');
},
onComplete: function () {
alert('boo-yah!');
},
onError: function () {
alert('aww shucks cletus, it done don't worked');
}
});
Then, in your SSJS, you can retrieve your value, like this:
var mySubmittedVal = context.getSubmittedValue();
Happy Coding!
Atul Saxena, Jan 16, 2012 9:40:47 PM
Can you provide a sample database with the above mentioned code?
Best Regards
Atul Saxena
jmdatul@gmail.com
Jeremy Hodge, Jun 27, 2010 11:06:10 PM
@Lars ... I can't think of a case where this technique would be undesirable ... in a GET the value is passed by appending &$$xspsubmitvalue=your-value-here to the URL sent to the server, so you have to be URL friendly, but it does get encoded before being sent, so just follow good URL practices, and you should be fine
Lars Berntrop-Bos, Jun 27, 2010 8:38:10 PM
Great! a tip with use cases! Are there circumstances when you would not use this technique?