« Back to home

Better string lists in XPages

Like Notes, XPages supports multi-valued fields. You can set a separator for multiple values, and tell XPages whether to trim whitespace from around each value. Unfortunately, if you have (say) a list of string values, the separator ends up with no whitespace after it. This can look ugly: Mon,Tue,Wed Ideally we’d like to display the multiple values with a space after each comma, and also accept separators like newline or semicolon when entering data.…

Read more »

Implementing live search on a web form using XPages

Given that people find it hard to select from more than around 8 options, the “drop-down selector with live search filter” design pattern is useful for all sorts of situations. If you have a reasonably small number of options, you can do it all client-side. A couple of thousand select items can be read as JSON and filtered client-side without too much of a performance hit — at least, on the desktop, with a reasonably fast Internet connection.…

Read more »

Domino XPages namePicker vs Directory Assistance

A common need in Domino applications is a way to add one or more users to a list using their Domino IDs, for example to add additional allowed editors to a document. In the Notes client, this is pretty easy — you select “Use Address dialog for choices” in a drop-down, and optionally check the two boxes to turn on autocomplete. Done. In XPages, it’s nowhere near that simple. The XPages Extension Library — which is now a standard part of Domino — provides a Name Picker componebnt, xe:namePicker.…

Read more »

XPages, Bootstrap, and form validation

I’ve recently been experimenting with Bootstrap for page layout, now that it’s an official part of the XPages Extension Library for Domino. After some simple test pages, I decided to put together a standard data entry form to see how painful that was. A typical Bootstrap form’s HTML for a single field looks like this: <div class="form-group"> <label for="email1">Email address</label> <input type="email" class="form-control" id="email1" placeholder="yourid@example.com"> <span class="help-block">Your Internet e-mail address</span> </div> If you have a validation error to display, and want to show a feedback icon, the HTML balloons up to something like this:…

Read more »

XPages JavaScript mystery meat

When using XPages, I try to build as much as possible in Java, and then use as little JavaScript as possible to glue the Java code into XPages. The main problem I hit when doing this is ensuring that my Java methods have the right type signatures to get found and called by JavaScript. It’s confusing to call someMethod(true) and find that you get a run-time error saying there’s no Java method someMethod(boolean), even though there is.…

Read more »

SLF4J and XPages Java debugging

I like to write code once and be able to run it both in the Domino XPages environment, and in regular Java environments. That means I don’t want to use any Domino-specific logging. I also like the SLF4J interface, at least on the Java source code side of things. In particular, I like how easy it is to log values using parameterized logging: // Painful JDK logging Logger logger = Logger.…

Read more »

Repeated XPages input controls with number-indexed field names

A common problem in interactive forms is to want a sequence of similar form fields. For example, a CD collection database will generally have a form allowing the user to enter the track details, with each track having its own editable text field. In Domino, you often want to store the values in numbered fields in a single document, rather than as separate documents; for example, Track01, Track02, Track03 and so on.…

Read more »

User friendly edit buttons with XPages

I wrote my first full application using XPages, the new IBM Domino web development environment based on Java Server Faces (JSF). It’s been quite a brutal learning curve, even given that I already knew both Java and JavaScript in some depth. Some things that are trivial ‘the old way’ (in Notes) are harder on the web with XPages. For example, when you try to edit a document and don’t have permission, the Notes client will give you an error message.…

Read more »

Scope variables mysteriously null in XPages

I just spent about a day tracking down the cause of a problem in an XPages application, which turned out to be due to a truly trivial error that produced no warnings or error messages. So, here’s a writeup of the issue… I was building a live search page, with various form components set out for selecting search options. I followed the normal pattern of binding the components to various parameters on requestScope, and then having an event handler which pulled them out, constructed a search string, and passed that to the view.…

Read more »

Cookies with XPages

My first XPages app is coming along nicely. Today I needed to add some cookie support, and discovered that the otherwise comprehensive Mastering XPages had no information on the topic. There’s a post on the Lotus Developer Domain, but it’s a bit vague and makes the whole thing look harder than it really needs to be. I started by writing myself a quick Server Side JavaScript library to encapsulate the details.…

Read more »