Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search


Home > Work with XPages in the Notes Client
xpageswiki.com
is maintained by 
Julian Buss.
You can hire me.

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.

CSS properties that don't work


The a:visited property does not work in Notes. Workaround: write an onclick handler for a link like this:
<a href="..." onclick="dojo.addClass(this, 'clicked')">...</a>


and define a CSS class like this:
.clicked {color:red}

Created by Anonymous on Jan 6, 2011 5:02:15 PM

Thank you for the tip.

Unfortunately, it doesn't work always. If you position your cursor in a rich text (CKEditor), the ESC key will still work.


Add Comment

Name:
Comments:
How to take your XPages App to the iPhone, iPad, Android: use Domino To Go!
Do you look for an XPages Workflow solution? Take YouAtNotes Workflow.