The Validation groups node allows you to define custom validation rules for groups of fields.
Validation group can then be selected on a Shopping Cart app, and when the customer attempts to proceed to the Checkout-step of the checkout flow, the values of fields with validation are tested against the validation rules - if a field does not validate you return to the previous step.
To create a validation group:
- Click New validation group
- Provide a name and check *Disable validation if all fields are empty if relevant (typically for debugging)
- Save
Validation groups consist of a set of fields, and for each field some validation rules such as 'must contain @' or 'Required'. To add a field to the validation group:
- Click Manage fields
- Click Add new validation
- Select a Field for validation rules
- Decide on a validation Rule policy for this field:
- All rules must validate
- At least one rule must validate
- Click Save
For each field you can then add validation rules as necessary, when clicking the specific field on the list:
- Click Manage rules
- Click Add new rule
- Select an Operator (e.g. Contains) and optionally a parameter (e.g. @)
- Click Save
The following operators are available:
| Operator | Description |
|---|---|
| Required | Checks that the field is not empty |
| Contains/Does not contain | Checks for the presence/absence of a specific value |
| Equals/Does not equal | Checks the field for an exact value (and either approves or rejects it) |
| Is integer/Is numeric | Checks that the field contains an integer (whole numbers) or is numeric (whole numbers and decimals) |
| Minimum length/Maximum length | Checks the minimum or maximum length of a field value (in characters) |
| Is less/greater than | Checks against a minimum or maximum value. Works for both numbers and alphanumeric characters |
| Is valid email | Checks if the value is a valid email address |
| Is valid/Is not expired/Is currency proper (Gift card) | Checks if the value is a valid, a not expired gift card or the correct currency |
| Is valid/Is not expired (Voucher) | Checks if the value is a valid or a not expired voucher |
| Regular expression | Allows you to enter a regular expression and check the field value against that. This allows you to check for a variety of formats, e.g. postal codes, phone numbers, and so forth. For more details in regular expressions, please see .NET’s rules for regular expressions. |