Adding a Validator to a spotlight allows the field to accept only the specified form of input. One or more Validators can be applied on a field. Essentially, it prevents inaccurate data from being entered into your application. If the user enters invalid data, the user will be prompted to update the entry. letzNav performs validations on specified fields keeping your application data accurate.
The following Validators are available:
Required Field: Shows an error if there is no content in the field.
Regular Expression: Enables the user to add a regular expression to evaluate the content inside the element.
Length Constraint: Restricts the length of content in the element.
Custom Validator: Enables the user to define a custom function for validating the element under spotlight.
Steps to follow:
Step 1: Login to the Editor using valid credentials. Click on Validations.
Step 3: Click on Add Validator and select the type of Validator that needs to be added.
Select any of the required Validator types.
If a Required Field Validator is selected, the user is required to enter data.
If length constraint is selected, we can specify the conditions for the length of the input that must be entered in the field.
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.
Once the validation is applied to the spotlight, The acceptance of Regex by the spotlight can be observed below:
Step 4: After choosing the Validator and providing required information, click on Save
The Validation Frames will be displayed as a list in the admin. Green Dots next to the frame indicate that the frame is published.
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.