Validation Explanation
What is a Validation?
A validation is a block of code used to validate fields in a Pragmatic form. It operates through a JavaScript function that, using parameters, has access to the form’s context and the environment in which the field with validation is being used. This ensures that the entered data meets specific criteria before being accepted and processed.
Why are validations useful?
Validations are essential because they ensure that one or more fields in a form meet specific conditions before the user submits it. This guarantees that the entered data is correct and complete, preventing errors and maintaining data integrity. By implementing validations, precise criteria can be defined that users must adhere to.
Components
Validation List
In this section, users can view all previously defined validations. Each validation is clearly and neatly presented, making it easy to identify and select the desired validation for viewing or modification.
Search Filters
Users can utilize search filters to find specific validation instances. They can filter instances by form and/or form instance ID, allowing them to quickly locate the desired records.
Creating a New Validation
To create a new validation, users need to click the create button ("+") located in the interface. This will open an intuitive interface that guides users through the process of designing and configuring the new validation, allowing them to customize it according to their specific needs.
Execution mode
When creating a validation, it’s important to define its execution mode, as this will determine how the validation behaves in relation to the form instances that use it:
Current version: When this option is selected, all form instances using this validation will always access its most recent version. This means that any modification made to the validation will be immediately reflected in all instances that use it, even in those that existed before the modification.
Historical version: When this option is chosen, each form instance will maintain a copy of the validation as it was at the time of its creation. This means that subsequent modifications to the validation will not affect existing instances, as each one will preserve the version of the validation that was in effect when it was created. This option is useful when you need to maintain historical data consistency or when validation modifications should not affect existing instances.
Modifying Validations
Users also have the ability to edit existing validations as needed. They can access the edit options for a specific validation by clicking on it within the validation list and making the necessary modifications.
