Im facing a problem with sitecore item validator when I try to save the data.
The purpose of my validator (the class inherit from StandardValidator) is to simply check if, atleast, field A or field B has a value. If not, I prevent the data to be saved by throwing a ValidatorResult.CriticalError
However, sitecore is having a strange behaviour. Instead of doing the validation on the newly inputed data, he's getting the data already saved and trying to perform the validation on them.
I think the purpose of the validator is to validate the new data before saving, but at the moment it try to validate the data already saved. Is this a bug ? Or Am I missing something ?
By the way, here is how I retrieve my fields inside of the Evaluate() function
protected override ValidatorResult Evaluate()
{
Sitecore.Data.Items.Item item = this.GetItem();
Sitecore.Data.Fields.MultilistField first = item.Fields[FieldOne_Name];
Sitecore.Data.Fields.MultilistField second = item.Fields[FieldTwo_Name];
//Processing code here...
}
Any hint is more than welcome!
Thank's