Configuration¶
In this chapter I will explain on how you can add custom validation for the Phone Input Mask extension.
By default this extension comes with two types of validators:
- A mask validation, you can provide your own custom mask.
- A E.123 validation. The E.123 is an international standard for phone number formats.
Navigate to Administer > Customize Data and Screens > Phone Input Masks. In the screen following you can can add validation rules.
Multiple
You can have multiple validation rules. Validation will fail when all rules will fail.
Click on Add Phone Input Mask
Give your validation a title.
Select a type of validation which is either mask or E.123.
The E.123 follows an international standard. The mask gives you the ability to configure your own custom formats. Below is an example of how to use the mask validation type for the German DIN 5008 International phone numbers.
Validation of the German DIN 5008 International Phone Number format.¶
The German DIN 5008 international phone number format is configured as follows.
* Select mask as validation type.
* Set mask to +00 0099 0000000
* Set Example Phone Number to +49 30 1234567
Validation of the German DUDEN Phone Number format.¶
The German DUDEN phone number format is configured as follows.
* Select mask as validation type.
* Set mask to 0 0099 / 90 00 00 00
* Set Example Phone Number to 0 3045 / 12 34 56
Now press save.
Mask explained¶
The mask consists of special characters. Each character is either the user can or the user has and then follows the specification of the character.
The following characters have a special meaning:
#
User can enter any digit (0-9), space, minus or plus sign~
User can enter any space0
User has to enter a digit (0-9)9
User can enter a digit (0-9)+-()
special formatting character.