The message is displayed when the related Web page is displayed.
If a validation function invokes sysLib.setError(), the Web page is redisplayed automatically when the function ends.
The first of the three signatures shown for the function in "Syntax" is available in JSF handlers or in VGWebTransaction programs, while the second and third are available only for JSF handlers:
You can associate multiple messages with a field or with the JSF handler. The messages are lost if the JSF handler runs a forward statement, or if the VGWebTransaction program runs a transfer or show statement.
You can use sysLib.setError() in the function specified in the onPostRenderFunction property of the JSF Handler, but not in the functions specified in the onPostRenderFunction or onConstructionFunction properties.
sysLib.setError( fieldInError anyPageVariable in, msgKey STRING in [, msgInsert STRING in])
sysLib.setError( this enumerationThis in, msgKey STRING in {, msgInsert STRING in})
sysLib.setError(msgText STRING in)
If sysLib.setError is issued from a VGWebTransaction program, fieldInError is a field in the VGUI record that is specified in the show or converse statement, or in the inputUIRecord for the program.
Invalid file name {0}
The following example shows an entry from the message file errorMessages_en_US.properties:
badname = The name you entered, {0}, is not valid.
userName STRING = getUserName(); // ask for input rc = validateUserName(userName); if (rc < 0) SysLib.setError( SysLib.getMessage( "badname", [ userName ] ) ); end
Platform | Issue |
---|---|
Java generation | The function sysLib.setError() is not supported in a service. |
JavaScript generation | The function sysLib.setError() is not supported. |