Skip to main content

Validation

Validation means to check if given data meets specific expectations. This is especially important for EditViews. For example, ADITO automatically validates EntityFields that are marked as mandatory: As long as those fields have no value, they are internally treated as invalid, with 2 visible effects:

  • the "Save" button is disabled and
  • a message is displayed stating "Required value is missing".

Besides these automatic validations, ADITO provides the option of additional validations, via process properties named onValidation. These properties are available on 2 levels:

  1. at the Entity, for performing Entity-wide validations. In this case, the onValidation process is triggered whenever any EntityField is entered.
  2. at the EntityField, for performing EntityField-specific validations. In this case, the onValidation process is triggered on focus loss of the respective EntityField.

In both cases, you are free to enter any validation logic you like. ADITO will treat the result of this process as follows:

  • The input value will be treated as valid, if
    • the process' result is true:
      result.string(true);
    • the process has no result.
  • The input value will be treated as invalid, and the "Save" button will be disabled, if
    • the process' result is false:
      result.string(false);
    • the process' result is a text, e.g.:
      result.string("The end date must not be equal to or earlier than the start date.");
      This is the most common option. In these cases, the given text is displayed next to the (disabled) "Save" button.