We have seen in the previous recipe how to use VTypes to apply more advanced validation to our form's fields. The built-in VTypes provided by the framework are excellent but we will often want to create custom implementations to impose more complex and domain specific validation to a field.
We will walkthrough creating a custom VType to be applied to our telephone number field to ensure it is in the format that a telephone number should be.
Although our telephone number field is split into two (the first field for the area code and the second for the rest of the number), for this example we will combine them so our VType is more comprehensive.
For this example, we will be validating a very simple, strict telephone number format ...