page validations
There are instances when Editors should to be informed in form of warning and information rather to stop them and display error messages. For self note IValidate interface can be used for this purpose. e.g
public class StandardPageValidator : IValidate<StandardPage>
{
public IEnumerable<ValidationError> Validate(StandardPage instance)
{
if (instance.Name.Length < 10)
{
return new List<ValidationError>() {
new ValidationError() {
ErrorMessage ="Name is very short",
PropertyName = "Name",
Severity =ValidationErrorSeverity.Info,
ValidationType =ValidationErrorType.AttributeMatched
}
};
}
return Enumerable.Empty< ValidationError>();
}
}
References:
http://world.episerver.com/documentation/Class-library/?documentId=episerverframework/7.5/e53f458f-f4a1-2904-620d-cad9167f3387
http://world.episerver.com/documentation/Class-library/?documentId=episerverframework/7.5/2a269a53-76ff-8c86-5984-5512fbe9f9b9
Comments