uniface.ValidationError

The uniface.ValidationError object provides access to the error number and message of a validation error on the server. It is returned by the FieldErrorContext.getError function when used in the showError and clearError web triggers.

Syntax Error Properties

Property Name Description
message Validation error message.
valueInError Field value that caused the validation error.

Description

A uniface.ValidationError object is generated when validation fails on the server after data has been submitted from the client.

You can access the properties of the uniface.ValidationError using the getError function of the field. For more information, see getError().

Using uniface.ValidationError

For example, in the following code, the showError web trigger is used to display an alert box with the information about the error.

webtrigger showError 

 javascript
  // this = the current FieldErrorContext object
   var vErrorObject = this.getError();  Callout 1
   var vErrorString = "There is a Validation Error.\n\n";  Callout 2
   vErrorString += "Value in error: " + vErrorObject.valueInError+ "\n\n";  
   alert(vErrorString); // Show error alert box Callout 3
  endjavascript
				
  return true    Callout 4
				
end
  1.  Get the ValidationError object using the field's getError function.
  2.  Extract the elements of the error object and put them into the variable vErrorString.
  3.  Display an alert with contents of the vErrorString variable.
  4.  Return true to enable the default Uniface error handling.

Related Topics