Skip to main content link. Accesskey S

XPages Wiki

Submit Search

YouAtNotes XPages Wiki


Home > Work with XPages in the Notes Client

Work with XPages in the Notes Client

ShowTable of Contents

where does the output of JavaScript print statements go


If you print out something from JavaScript, it is visible via help -> Support -> View Trace.

As an alternative, you can start the client with "notes.exe -RPARAMS -console", then the print statements go to the console.

How to see the rendered source


If you view a XPage in the client you have two new buttons to view the source and the browser configuration:


How to check if the XPage runs in the web or the client


Use @ClientType.

Hide a control from the Notes client, but show it in the web


set the property "rcp.rendered" to true.

Caution with @DbLookup() and @DbColumn()


When using @DbLookup() and @DbColumn make sure you always give the database to look into as first parameter, for example:

@DbColumn(@DbName(), "myview", 1);


The following abbreviation does work in the web, but DOES NOT WORK in the client:

@DbColumn("", "myview", 1);

Add session ID to computed links


See Steves Blog

Save the session ID in a scope Variable:

if(@ClientType()=="Notes"){
      sessionScope.sessionID="?SessionID="+facesContext.getExternalContext().getRequest().getSession().getId();
}else{
      sessionScope.sessionID="";
}



Then add sessionScope.sessionID to your computed link URLs.

Access an image resources on the server


See Steves Blog

Refering an image resource which is not in the NSF needs a slightly different syntax on the client:

if(@ClientType()=="Notes"){        
      return ".../oneuiv2/images/iconSearch16.png"
}else{
      return "../oneuiv2/images/iconSearch16.png"        
}


(Note the extra dot)

Work with events


Publish events via client side javascript:

XSP.publishEvent("publishString", "hello", "string");
XSP.publishEvent("publishNumber", "12", "number");
XSP.publishEvent("publishBoolean", "true", "boolean");
XSP.publishEvent("publishJson", {"userId": "jsmith"}, "JSON");
XSP.publishEvent("publishString", "#{javascript:document.myfield}", "string"); // push a value computed by server side javascript


Receive event and use it's value:

In the XPage events -> Components create a new event with some name.

In the CLIENT javascript you can modify the returned event's value:

return thisEvent.value


In the SERVER javascript use the following to get the value:

context.getSubmittedValue()

Use component properties defined in the composite application editor


When adding a XPage as component on a composite application page, you can define custom properties: right-click the XPage-component in the composite application editor -> advanced properties.

You can access those properties in your XPage javascript with:

context.getComponentParameter("advancedParam");

Prevent closing an XPage with ESC


found by Tommy Valand

Place this client side JavaScript somewhere in the XPage:

dojo.addOnLoad( function(){ 
 dojo.connect( document, 'keydown', function(e){  
         if(e.keyCode === 27){ dojo.stopEvent(e); }        
 });
});


This code stops the event "key 27 pressed" from bubbling up. "27" is the keycode for the ESC key.
See what's possible with Xpages.
Have a look at our ServiceCommunicator website
and the YouAtNotes Support.
Use  searchlotus.com  for news in the Web related to Lotus Notes and Domino,
and to search those sites.
Check  youatnotes.com  for great Lotus Notes, Domino and XPages software.
Did this wiki help you?
Did this saved you time? Express your gratitude by making a donation:
PayPal - The safer, easier way to pay online!