AI OnAI Off
IValidate would return a list of ValidationError, if your implementation returns a list that contains an error, like this
return new List<ValidationError> {new ValidationError()
{
PropertyName = //property name,
Severity = ValidationErrorSeverity.Error,
ValidationType = ValidationErrorType.StorageValidation,
ErrorMessage = errorMessage
}};
that would cancel the save. I am not quite sure if the data is saved to draft or not, probably not, but you can try
Hi Quan,
thanks for the quick reply!
Unfortunately that is not the case as far as I can see. I am currently running version 11.20.14 of EpiServer. The following behaviour can be observed:
Update: Fixed content error (original in strikethrough)
Hey guys,
I am seeking advice on how to best implement custom validation logic on a custom page content instance (but the same may apply to all other content data as well I think). The documentation section Validate object instances (optimizely.com) list two main hooks that can be used for this: IValidate<T> and IContentSaveValidate<T>
My environment:
My goal:
Ideally I would like to prevent the save from being commited to the data store, but my experiments have shown that this is easier said than done. This leads me to the questions that emerged when experimenting with the validation infrastructure.
My questions:
Best regards,
Sebastian