Validation Rules
Validation rules set which values a field accepts. When someone fills out a certificate, the platform checks the entered values against these rules and shows an error for each rule that is not met.
The main settings of a field (Required and the type's own settings) are at the top of its configuration panel. Further rules are added with Add Validation Rule under Advanced Validation.
The video on the Field Types page shows the type settings and how a rule is added to a field.
Rules by Type
Required
A certificate cannot be completed without a value for a required field. Required is only available for fields inside a group, and it is locked for the fieds with a fixed value.
Text
- Minimum Length / Maximum Length: the allowed number of characters.
- Format: Email, URI, UUID, Hostname, IPv4, or IPv6.
- Pattern: a regular expression the value must match. For example,
^[A-Z].*requires the text to start with a capital letter. - Fixed Value: set one predefined value, so users dont have to enter anything.
Number
- Allow only whole numbers
- Minimum / Maximum: the value may be equal to the limit.
- Exclusive Minimum / Exclusive Maximum: the value must be strictly above or below the limit.
- Multiple Of: the value must be a multiple of the given number.
5allows 5, 10, and 15.
An example of a Number field with these rules is shown under Type Settings.
List, Dropdown, Toggle, Date, Image
- List: Min Items / Max Items.
- Dropdown: Fixed Value, and the list of options. Under a condition, Options limits which of them are offered (see below).
- Toggle: Allowed Values (Any, Must be true, Must be false), Fixed Value.
- Date: Required, Fixed Value and the date format.
- Image: Required, Fixed Value and the image type.
Conditional Validation Rules
A validation rule can apply always, or only when a condition on other fields is met. For example, a Minimum on a numeric field can apply only when a dropdown has a certain value.
Click Add Validation Rule, then Add Condition to build a new one, then choose the rule. The condition editor is the same one described under Conditional Properties. The difference is the effect: a conditional property shows or hides a field, while a conditional validation rule only changes which values the field accepts.
Limit Dropdown Options With a Condition
A dropdown can offer only some of its options, depending on the value of another field. Example: a Material dropdown (Steel, Aluminium) and a Grade dropdown (S235, S355, 6061, 7075). When Material is Steel, Grade should offer only S235 and S355.
- Open the dropdown (Grade) and click Add Validation Rule.
- Choose or create the condition (Material Equals Steel).
- Choose Options and untick the options that should not be available while the condition is met.