getError()
Returns an error object for the field, if a syntax error or validation error occurred.
Return=
this.
getError()
vError = 'Error: ' + this.getError().message ;
Return value
Depending on the type of error, getError() returns:
- uniface.SyntaxError object if a field syntax error occurred
- uniface.ValidationError object if a validation error occurred
null
if no error has occurred.
Description
Use the getError function in the following web triggers to access the error number, message, and the incorrect field value that caused the error:
- OnSyntaxError and OnSyntaxErrorResolved
- showError
- clearError
For more information, see uniface.SyntaxError and uniface.ValidationError.
In OnSyntaxError
webtrigger OnSyntaxError scope input endscope javascript "use strict"; // this = the current field var vError = this.getError(); var vLabel = this.getLabel(); var vErrorMsg = 'Error: ' + ' - ' + vError.message + '\n' ; if (vLabel) { vErrorMsg += 'Location: ' + vLabel.getValue() + '\n' ; } else { vErrorMsg += 'Field: ' + this.getName() + '\n' ; } vErrorMsg += 'The incorrect value is: ' + vError.valueInError; alert(vErrorMsg); return true; endjavascript