Adding Validation rules to a Spotlight allows the field to accept only the specified form of input, which helps to avoid common user errors. Apty performs validations on specified fields keeping your application data accurate.
This article covers the following sections:
- types of Validators,
- adding a Validator,
- making Validation rules accessible to the end users, and
- deleting Validators.
Types of Validations:
This rule checks whether the field is empty and if so, the form with the input will not be submitted and the error with will be shown to the end user.
Checks whether the input fits within the range of the specified length. If the length of the user input is not within the range specified in the validation rule, the input will not be submitted and the error with will be shown to the end user.
Powerful way to check the format / accuracy of the input provided by the end user. For example, to check whether the user has entered a valid email address, the following regular expression is used:
To add a Validator:
To add a single or multiple Validation rules to the user input field, follow the steps below.
1. Login to the Apty Studio using valid credentials. Click on Validations.
3. In the Validators section click + Add Validator and select the type of Validator that to be added.
4. Select the type of a validator to be added:
If this Validator is selected, the user is required to enter data. If the field is empty, a system provides automatic error message: "This field is required".
If length constraint is selected, specify the conditions for the length of the input that must be entered in the field. You can define lower limit, upper limit or both when defining expected input length.
If the Regular Expression Validator type is selected, A regular expression that specifies the format of acceptable input must be given in the space opened. The specified regex gets applied to the spotlight. Additionally, provide an error message to be displayed if the format of input does not correspond to the form specified in the regular expression.
To make Validators accessible to end users:
When all the Validations are added to the required Spotlights in a Frame and are ready to be used, system still preserves the Frame in the Draft status, unless stated otherwise.
Yellow dots indicate the frame is in draft mode and blue dots indicate the frames are ready to be published. Validations can be edited only while the frame is in Draft Mode.