Archive

Posts Tagged ‘CGIVariables’

XPages: Eventparameters

Here is another advice for the horror we call XPages.

In XPages you have, theoreticaly, the possibility to pass a parameter along with an event. Sounds quite useful, doesn’t it? Unfortunately, they don’t work properly. It wasn’t possible for me to pass on some eventparameters. They simply didn’t arrive at the target.

Here is a workaround:

You can pass the parameter clientside and use them serverside after the request:

var docId = new CGIVariables().getURLParam("documentId");

Here is a link to a quite useful library which I use from time to time in my XPages:10.lotus.com

I added the following function:

this.prototype.getURLParam = function (name){
   name = name.replace(/[[]/,"\[").replace(/[]]/,"\]");
   var regexS = "[\?&]"+name+"=([^&#]*)";
   var regex = new RegExp( regexS );
   var results = regex.exec( "?" + this.request.getQueryString() );
   if( results == null ) {
      return "";
   } else  {
      return results[1];
   }
}
Advertisements
%d bloggers like this: