November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I have mostly used page or block instance to validate a specific property instead of proprety type instance itself. Looking at the code I believe yield is the issue here you may want to check. If you use this in the validate method it should work.
var errorList = new List<ValidationError>();
if (instance != null)
{
errorList.Add(new ValidationError
{
ErrorMessage = $"Link item text is {instance.Text}",
Severity = ValidationErrorSeverity.Error
});
}
return errorList
Thanks for your response.
Unfortunatey your suggestion throws the same error so there has to be something else that's off.
Hey oliaxe,
can you specify the major version of the CMS you are working with (and ideally update the thread's tags as well). I am still in the 11 world and suspect you are referring to version 12 since I found out it there it was made much simpler to work with LinkItem instances directly.
Best
Hi,
I'm working in a validator for LinkItem.
It does validate what I want and it works when I'm debugging it.
However it does not work like it should in the CMS.
Instead of showing my warning message, it displays a popup with this text:
Could not save property. The page may have been changed by another user. Please reload the page.
It seems to be something with the scoping, I had the same issue with another validator for an Image block. That did work when the image block was standalone but not when the block was used as a property, and I guess it's the same with the LinkItem property.
Here's how my validator is built:
Does anybody know how I can validate the text on LinkItem and other similar properties?
Thanks.