Things I learnt about XPages today – Do not use the quick edit tools

I thought I’d document over the next few months my baby steps in learning XPages. Although I won’t be using XPages for any development in the short to medium term, I’m going to start to investigate the accessibility implications of each option before developing anything in anger.

My first step – and it really is a first step almost embarrassing step, was to simply add html to my page so that I can develop pages with a semantic structure. Stop laughing at the back. We all have to start somewhere.

The Designer client offers some simple tools to style on-screen text

screen-capture

Don’t use them. The html this toolbar produces uses inline styles rather than standard html and explains why the discussion template’s html seems to be missing any form of structure.

Using the bold face option adds

<span style="font-weight:bold">Bold text</span>

The italic and underline also generate inline styles. So using these options could bloat your code considerably.

The increase and decrease font size option also generates in-line styles:

<span style="font-size:14pt">14 pt text<span>

As you can see, it also uses ‘points’ as the default unit rather than pixels or ems, a unit I’ve avoided because it renders differently across browsers. So another reason to avoid this edit bar.

As far as I can see, there doesn’t appear to be an option to set headings and paragraphs, or to insert rules and lists. So how do you add them?

One option appears to be to use the ‘computed field’ option and to set the ‘content type’ to html and for the ‘value’ to use the javascript return function to return html. For example

return ("<h4>This is the header</h4>")

This seems to be a too long winded for my liking so the other alternative seems to be to switch to ‘source’ view and to manually add the html directly in the source view. I have to admit, I’m surprised that there isn’t an WYSIWYG tools to help you produce a page with any form of semantic structure.

One word of warning. It appears 8.5 continues Domino’s habit of generating BRs for every carriage return.

Leave a Reply