Skip to main content

Validators

Validators are a set of rules that will check the content of an attribute when entered into the system and reject the addition of data if it does not meet these rules. For each attribute field, you can configure validators. This can be done by going to the attribute field settings and scrolling down to the "Validation Rules" section.

The set of validators may vary depending on the data type.

Types of Validators

Each data type has its own set of available validators. Below are all possible validators for all data types you may encounter.

Required field

This rule indicates that this field must be filled out. It does not require additional settings.

Trimming spaces around incoming data

This rule indicates that spaces at the beginning and end of the string will be removed. It does not require additional settings.

Checking the string

This rule allows you to configure parameters for text type. In the additional settings, you can specify a fixed string length or set a range using minimum and maximum values.

URL verification

This rule allows you to set a string value only if it is a link. It does not require additional settings.

Checking for a number

This rule checks whether the value is a number. In the additional settings, you can specify whether the number is an integer, as well as set minimum and maximum values for the number.

Rounding a number

This rule does not check the value for numeric type. Instead, it performs rounding of the number according to the rules specified in the additional settings. In the additional settings, you can specify the order and rule for rounding the number.

Email Verification

This rule checks whether the value is a string. It does not require additional settings.

Default value

This rule will set a default value for the attribute if no value has been entered. In the additional settings, you can specify the value that will be set by default.

Given list screening

This rule checks whether the entered value in the attribute matches one of the values specified in the validator's list. In the additional settings, you can specify values separated by commas, as well as set logical negation.

Field mask

This rule checks whether the entered data matches the value of the mask. In the additional settings, you can specify the mask using special characters.

Regular expression validation

This rule checks whether the entered data matches a regular expression. In the additional settings, you can specify a regular expression. You can learn more about regular expressions "here".

Regular expression

Although you can add multiple validators to one attribute field, validation using regular expressions is not compatible with some other types of validation.

Comparison

This rule compares the value of the specified attribute with another to ensure that their relationship matches the comparison described in the property. In the additional settings, you can specify the type and value of the comparison, as well as the comparison operator.

Logical

This rule checks whether the attribute value is logical. In the additional settings, you can configure the interpretation of non-boolean values.

Size

This rule checks the size of the image. In the additional settings, you can configure the height and width of the image in pixels.

Checking files

This rule checks the uploaded file for compliance with the parameters. In the additional settings, you can configure the minimum and maximum values of the file size units, as well as the type of measurement units.

Custom Errors

In each of the validators, you can add an error message. This text will be visible to the user if the validator does not allow the data. This can be done through the validator settings.

Examples

Example of email field validation.

In this example, the string value will be added:

  • Removing possible spaces at the beginning and end of the string
  • Checking that the string is an email

Example of password field validation.

In this example, the string value will be added:

  • Checking the length and composition of the string using a regular expression

Example of image field validation.

In this example, the string value will be added:

  • Checking the dimensions of the image
  • Checking the weight of the image
  • Custom error