getError()

Returns a uniface.SyntaxError object for the field, if a syntax error occurred.

Return=Field.getError()

vError = 'Error: ' +  this.getError().exceptionCode + this.getError().message ;

Return value

Returns a uniface.SyntaxError object for the field in error, or null if no syntax error has occurred.

Description

Use the getError function in the OnSyntaxError and OnSyntaxErrorResolved web triggers to access the error number and message of a field syntax error, and the incorrect field value that caused the error via the uniface.SyntaxError object. For more information, see uniface.SyntaxError.

getError

webtrigger OnSyntaxError
scope
   input
endscope

javascript
  "use strict";
  // this = the current field
  var vError = this.getError();
  var vLabel = this.getLabel();
  var vErrorMsg = 'Error: ' +  vError.exceptionCode + ' - ' + 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