@ErrorMessage (JavaScript)

Posts a message to a message (Display Error) or messages (Display Errors) control.

Defined in

@Functions (Extension Library)

Syntax

@ErrorMessage(message:string, component:any) : void
Table 1. Parameters
Parameter Description
message:string The message.
component:any A component identifier. Specifies the message source.

Usage

This @function does not affect submission of the XPage to the data store.

The @functions @ErrorMessage, @InfoMessage, and @WarningMessage are functionally the same.

Examples

This onclick event for a submit button displays an error message and cancels submission depending on user input. A message (Display Error) or messages (Display Errors) control must be present on the page.
var val = getComponent("inputText3").value;
if (val == 7 || val == 11) {
	@ErrorMessage("Do not enter 7 or 11 in this field", "inputText3")
	return false // must explicitly cancel submission
}