Validation rules allow you to validate the data that is entered by the end user. With these rules, you can notify users if certain conditions are not met when they attempt to take an action, ensuring data accuracy and integrity.
Validation Group Name
This is the name of the validation group attached to the action. You can leave it empty to execute the validation at all times.
Error Message
This message will be shown to the user when the validation rule is triggered, helping users correct their input.
Rule Condition
The condition for validation. If this condition is met, the error message will appear, and the form will not be validated.
Using Regular Expressions
You can also use Regular Expressions (RegEx) for validation. To set up a RegEx validation, use the match
function within the rule condition. This allows you to check if the input matches a specific pattern, ideal for validating formats such as email addresses, phone numbers, or other structured inputs.
Example
return (!$Xml.Evaluate('.').match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi))
In this example, the match
function checks if current node
contains a valid email format. If it does not match, the error message will be shown, and the form will not be submitted.