Quantcast
Channel: XPages – Xcellerant
Viewing all articles
Browse latest Browse all 216

Changing the Output Tag on a Computed Field in XPages

$
0
0

By default, a computed field writes out a <span> tag to the page around the contents of the field, but you can use the tagName property to change that.

For example, this computed field…

<xp:text escape="true" id="computedField1" 
  value="#{javascript:return 'Hello, World';}">
</xp:text>

… will result in this html:

<span id="view:_id1:computedField1" class="xspTextComputedField">
  Hello, World
</span>

But, if you change the tagName property to something else — for example a list item (li)…

<xp:text escape="true" id="computedField1"
  value="#{javascript:return 'Hello, World';}" 
  tagName="li">
</xp:text>

… it will produce this html:

<li id="view:_id1:computedField1" class="xspTextComputedField">
  Hello, World
</li>

The class name stays the same, but the surrounding tag changes. This can come in very handy.



Viewing all articles
Browse latest Browse all 216

Trending Articles