Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search


Server JavaScript

Page12

Browser compatibility

Julian Buss | May 18, 2009 8:48:44 PM | Tags:browser, client, UI

==Internet Explorer 8== IE 8 is supported since Domino 8.5.1. You can force IE8 to act like IE7 by using this code in beforeRenderResponse event: {code:} // first option uses compatibility mode, second option too but stronger // X-UA-Compatible: IE=7 // X-UA-Compatible: IE=EmulateIE7 if ...

Debugging and error logging

Julian Buss | April 6, 2009 11:58:21 AM | Tags:debug, error

==Show error page== The default error page does not tell you what was wrong. Use Page Properties -> XPage -> "display default error page" while in development. Reset this setting when going to production. ==Error handling== Sourround your code with an error handler like this: {code:|200} try { } ...

How to output custom content like print from an agent

Julian Buss | May 14, 2009 9:05:53 PM | Tags:code, javascript, agent

You can use server side javascript in a XPage to write custom content to the browser, just like with agents and "print" statements in classic web development. This tip is taken from Stephan Wissel from [[http://www.wissel.net/blog/d6plinks/SHWL-7MGFBN]]. - create a Xpage - set the "rendered" ...

How to use object oriented server side javascript

Julian Buss | January 6, 2010 1:53:35 PM | Tags:javascript

This is a short howto for people who know how to code object oriented in other languages. ==Create a class== {code:} function myClass(param1, param2) { var private_member1 = param1; var private_member2 = param2; this.method1 = function () { // do something this.method2 = function(param1, ...

Useful formulas and code snippets

Julian Buss | April 6, 2009 12:03:33 PM | Tags:code, formula, javascript

Here are some various snippets. ==Get the current username== Use {code:}session.getEffectiveUserName(){code} to the the name of the user who is logged on. Use @Name() to convert it for exampel to a CN name: {code:} @Name("[CN]", session.getEffectiveUserName()) {code} ==Check if a user contains a ...

Work with datasources

Julian Buss | August 19, 2009 9:48:06 AM | Tags:code, javascript, variables

==Where to define a datasource== You can define a datasource on different levels: * in the XPage properties * in the properties of a custom component * in the properties of a panel Use the folowing rule of thumb: If you need a datasource in your whole XPage and even in custom components which are ...

Work with Dates

Julian Buss | May 22, 2009 10:17:41 PM | Tags:code, UI

==General Tips== While working with dates in server side javascript, I noticed some glichtes in Domino 8.5.0. Here are some rules of thumb: Trying to convert a text to date with @TextToTime() may work, but in my case it mixed day and month values. My solution: parse the string yourself into year, ...

Work with documents and fields on the XPage

Julian Buss | April 6, 2009 1:12:07 PM | Tags:code, javascript

==Get and set a field on the XPage== ===Server JS=== {code:} getComponent("elementName").getValue(); getComponent("elementName").setValue("something"); {code} Note: you cannot access or set fields with visible=false. If you want to work with a field, but don't want to display it, give the field a ...

Work with events

Julian Buss | October 12, 2009 10:06:49 AM | Tags:code

In short, the events of a XPage with two custom controls (controlA and controlB) are executed in the following order: ==events executed once== Xpage -> beforePageLoad controlA -> beforePageLoad controlA -> afterPageLoad controlB -> beforePageLoad controlB -> afterPageLoad Xpage -> afterPageLoad ...

Work with events and partial or full refresh

Julian Buss | September 11, 2009 8:27:22 AM | Tags:code, javascript

==Run a partial update from client javascript== You can use the following function to trigger a partial update from client javascript {code:} XSP.partialRefreshPost(id); {code} "id" is the runtime ID of the control, that means you have to get it with "#{id:nameOfControl}". If you don't need to be ...

Page12
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.