Add a Validator

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 2: Create a frame and add a spotlight, otherwise click on the previously built frame and select the spotlight.

Step 3: Click on Add Validator and select the type of Validator that needs to be added.

Select any of the required Validator types.

Required Field

If a Required Field Validator is selected, the user is required to enter data.

Length Constraint

If length constraint is selected, we can specify the conditions for the length of the input that must be entered in the field.

Regular Expression

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:

Custom Validator

If the input format to be accepted by the spotlight involves more number of conditions or dependencies with the other fields, then Custom Validator can be chosen. Custom Validator provides a way to write custom JavaScript to validate the input.

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.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.