Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search


Home > UI > Work with Hide When on a XPage
xpageswiki.com
is maintained by 
Julian Buss.
You can hire me.

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