Complex validations (custom)
Complex validations requiring algorithm implementation are implemented by developers and added to the validator library located in Eximee Validation. In the case where validation is to be carried out through external services (e.g. ESB bus), it is necessary to use Service Proxy to make the given service available.
If validations do not require connection to external services, you can use lightweight script validators (more in: Script validators (validationScript)). Complex validators can be used for application fields, pages, or complex components (used later in the application).
Complex validations for components
In addition to requiredness and mask, specialized external validators can also be added to components.
Connecting a validator
To connect a validator, go into artifact edit mode and select any component that can have a validator connected. Then click the section Data quality in the component properties menu. After expanding the section, we will see the subsection VALIDATORS.

After clicking on VALIDATORS or the pencil icon, the validators window will slide out.

After selecting the option Choose validator we will be able to search for and select a given validator. The list contains standard validators and script validators. For a validator, you can define a call condition (field Add condition). This is a JavaScript condition in which you can use fields or session variables available in the application. The method of creating conditions is described in Expression language for defining conditions (conditions from getValue).

Simulation
Validators, just like external services, support the option to replace their operation with a simulation script. Connecting such a script requires selecting the tab in the validators window Simulation and selecting an available simulation script from the list.

From this level, we can also choose to create a new script by clicking the button Generate new script. The newly created script will have content generated automatically, consistent with the validator and the described separate code sections.

It should be remembered that such scripts will run only when entering the application with enabled application logic simulation mode!
Complex validations on the page
Adding validators on the page
Validators can also be added on the page:
If the page listens to fields that we pass to the validator, the validator is called when the field that the page listens to changes.
If the page does not listen to fields, the validator will only be called after clicking the button Next/Send.

Adding validators on a complex component
It is possible to add validators on a complex component. They will work as if they were added on the page where the complex component is located.
Adding translations of validation messages
Each validator returns a validation message. The message content may already be translated into Polish or may be in another language. After connecting the validator, go to the tab Translations and search for the appropriate error key to change the translation.
If the validator message contains parameters, then in the translation they should also be placed in the appropriate place.

Last updated
Was this helpful?
