message - Display Error

Displays error messages for one control.

Category

Core Controls

Syntax

<xp:message attributes>content</xp:message>
Table 1. Essential properties
Property Description
id Defaults to message1, message2, and so on.
for Identifies the target control.
Table 2. All properties
Category Properties
accessibility role, title
basics attrs, binding, dir, for, id, lang, loaded, rendered, rendererType
format showDetail, showSummary, tooltip
styling disableTheme, errorClass, errorStyle, fatalClass, fatalStyle, infoClass, infoStyle, style, styleClass, themeId, warnClass, warnStyle

All properties

Usage

By default most validation checks occur on the client before sending a request to the server. If validation fails, the client displays an error message in a dialog and cancels the server request.

If you want validation checks to occur on the server and the error message displayed in this control, you must set disableClientSideValidation to true for the target control.

To comply with accessibility requirements when using this control, it is recommended that, for a given input control, you associate the respective xp:message control using the aria-describedby attribute as illustrated in the example. This supports assistive technologies by providing a description to users when the input control receives focus describing the associated validation error message.

<xp:label id="xpLabel1" value="Enter any value" for="xpInputText1" />
<xp:inputText id="xpInputText1" value="#{sessionScope.foo}" required="true"
        disableClientSideValidation="true">

	<xp:this.attrs>
		<xp:attr attr name="aria-describedby" value="#{id:msgPanel}" />
	<xp:this.attrs>

</xp:inputText>

<xp:panel id="msgPanel">
	<xp:message id="message1" for="xpInputText1"/>
</xp:panel>
Note: It is possible to associate multiple descriptions with an input control by specifying a space separated list of client IDs of labels to the aria-describedby attribute.

Examples

Here an input box is bound to numeric data and does not validate on the client side. Following is an error display for the input box.
<xp:inputText id="inputText3" value="#{document1.number}"
	disableClientSideValidation="true">
	<xp:this.converter>
		<xp:convertNumber type="number"></xp:convertNumber>
	</xp:this.converter>
</xp:inputText>
<xp:message id="message1" for="inputText3"></xp:message>
If the user enters a non-numeric value in the input box, the following message appears in the error display:
This field is not a valid number