getError()
Returns the uniface.ValidationError object containing the error information as provided during the previous showError trigger.
Return=
FieldErrorContext.
getError()
vError = 'Error: ' + this.getError().message ;
Return value
getError returns:
- uniface.ValidationError object if a validation error occurred.
null
if no error has occurred.
Description
Use the getError function in the showError and showClear web triggers to access the error number, message, and the incorrect field value that caused the error.
getError
webtrigger showError javascript "use strict"; // this = the current field var vError = this.getError(); var vLabel = this.getField().getLabel(); var vErrorMsg = 'Error: ' + vError.message; if (vLabel) { vErrorMsg += '\n Location: ' + vLabel.getValue(); } else { vErrorMsg += '\n Field: ' + this.getName(); } vErrorMsg += '\n The incorrect value is: ' + vError.valueInError; alert(vErrorMsg); return true; endjavascript end