required - Required Flag

Enforces the submission of a value for a control.

Category

basics

Syntax

required="true|false"

Usage

In Design mode, click Validation under Properties and look for Required field, or click All Properties and look for required under basics.

By default, a control is not required.

When this property is true, the user cannot submit the XPage without entering a value for the control.

Examples

This Edit Box control is required.
<xp:inputText id="inputText1" value="#{document1.subject}"
	required="true">
	<xp:this.validators>
		<xp:validateRequired message="Subject is required"></xp:validateRequired>
	</xp:this.validators>
</xp:inputText>
This Edit Box is required for a certain user.
<xp:inputText id="inputText1" value="#{document1.subject}">
	<xp:this.validators>
		<xp:validateRequired message="Subject is required"></xp:validateRequired>
	</xp:this.validators>
	<xp:this.required>
		<![CDATA[#{javascript:if (session.getCommonUserName() == "Joe Bar") {return true}}]]>
</xp:this.required></xp:inputText>