Out of the box, Sitecore provides you the two ways to validate the content in the field.
- Validation and Validation Text
- Validation Rules
VALIDATION & VALIDATION TEXT
Go to your field item under your template and locate the fields as in the following screenshot:
The field itself doesn't require any explanation, although in the "Validation" field you can provide the regex for validating the field content and in the "Validation Text" field you can provide the message if validation is not met.
For example, for the demo purpose, I have put the email validation regex in the "Title" field and now try to enter incorrect email address in the Title field it will give the error message as in the screenshot below:
VALIDATION RULES
With validation and validation text you can provide only one rule to follow, but if you want to use multiple rules on a single field then you have to use validation rules.
To apply the validation rules go to the "Validation Bar" field and you can apply more than one rule to a field as shown in the screenshot below.
Have any doubt?
Email: prashant.tomar@hotmail.com
https://sitecorepeanuts.blogspot.com/2020/08/sitecore-field-validation.html
ReplyDelete