Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search

Available in the Appstore!All the content of xpageswiki.com for iPhone or iPad for offline access.

Home > UI > Work with Hide When on a XPage

Work with Hide When on a XPage

ShowTable of Contents
Each component on a XPage have the "visible" property which can be computed. If computed, your JS should return eithertrue orfalse or a empty string (same asfalse) or "1" (same astrue).

HideWhen based on a user role


Show the element if user has the role [role].

var v:Array = database.queryAccessRoles(session.getEffectiveUserName());
@IsMember("[role]", v)

Set visible for a component with JavaScript


var elem:javax.faces.component.UIComponent = getComponent("contentPopup");
elem.setRendered(true);

Make a field required when emulating computed when composed


1) Set visible property to true



2) create a computed field with the formula: getComponent(Id of above field).getValue()



3) select source tab and enter the <div> tag before and </div> tag after your field code as below, but not to include your computed field




<div style="display: none;"> <xp:inputText id= value= required= <xp:this.validators> <xp:validateRequired message=

</xp:validateRequired> </xp:this.validators> </xp:inputText> </div>



The reason for doing it this way is because any other way the required property doesn't evaluate to true



Hope this helps other XPage newbies



Dwain A Wuerfel


Add Comment

Name:
Comments:
Use  searchlotus.com  for news in the Web related to Lotus Notes and Domino,
and to search those sites.
Check  youatnotes.com  for great Lotus Notes, Domino and XPages software.
Did this information help you?
Please honor our efforts and flattr this!