Creating custom validations
Docxpresso comes equipped with the following standard validations:
- Date (the default date format may be set by the platform administrator in a global fashion)
That covers the simplest cases but certainly not all possible scenarios.
One may define custom validations that extend the predefined ones in ways that may be particularly useful for certain templates.
In order to do so you must provide the following data:
- Name: that uniquely defines the current custom validation.
- Type: that can be date or regular expression.
- Expression: the actual validation (more on this below).
- Description: a brief description of the custom validation that may further help to identify potential usages.
Date type validations
The date format, may be a combination of d, dd, D, DD, m, mm, M, MM, yy, yyyy, e.g. dd/mm/yyyy or DD MM dd, yyyy
If you want to use the reserved chars: D, M, Y, d, m and y as plain text you should include instead their corresponding HTML entities, namely: D, M, Y, d, m and y respectively.
Regular Expression type validations
In order to create a custom validation based on regular expressions you must be familiar with the standard.
It is out of the scope of this tutorial to explain how regular expressions work but there are excelent online tutorials that may be found on the Internet as well as online tools to test them: https://regex101.com/ that also include regex libraries with regular expressions for almost any use case that may be used out of the box.