Consider this field to explain these concepts.
- Field: Phone Number
- Type: Simple String
- Show in List view :Yes
- Mandatory (from expanded view): Yes
There is a section in the Advanced Editor labelled
Validations. Here, you can add validations to the fields. The validations are regular expressions that the field’s value will be validated against. You can select from a list of available regular expressions from the
Choose Validations dropdown menu (like we do below for a sample Phone Number field below), or you can add your own to the
You can also provide a guide to the user for what the input should look like by setting the
Input Pattern. You can select from a list of available patterns from
Choose Input Pattern or use your own.
In the above, we set a custom Input Pattern and switched on the
Underscore Placeholdercontrol. You can see the result of this below.
Underscore Provider turned on, underscores are placed in position to guide you on the number of required characters. If you leave this off, then you’ll have something like what is shown below. There will be no guides, but if you start entering characters, they will be formatted according to the pattern and when you reach the maximum number, the field won’t take more typed characters.
You can use both Validation and Input Pattern. If you use the Input Pattern by itself, the user can still enter the wrong information. In the example above, the field would validate even if the user doesn’t enter the required number of characters. So you should also use validation whenever necessary to ensure you get correct input.
If you set a validation regex as well as an input pattern, then switch on the
Force Validation control, the field will be validated according to the Input Pattern and the regex will be ignored. In the example above, if we used
Force Validation, then validation would fail if the user didn’t enter the number of required characters.