Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Just out of curiosity - is validation interface working properly for shared blocks?
I tried with the IValidate interface as well.
Validate method does not get executed on the first screen where editors have to enter required properties.
It only works on the second screen, when the block is already created and auto-saved.
Here's another one:
I have a page which has a local block that is decorated with a custom ValidationAttribute.
In edit mode, when I try to publish the page with invalid values, IsValid() method gets executed, and I see validation errors in edit mode. That's fine.
But when I correct the validation errors and try to publish the page again, the Publish button is no longer visible.
CMS-10475
We're having some issues with validation of properties on shared blocks in EPiServer 11.
Custom attribute:
[AttributeUsage(AttributeTargets.Property)] public class ValidYoutubeLink : ValidationAttribute { protected override ValidationResult IsValid(object value, ValidationContext validationContext) { ... } }
Shared block:
[ContentType(GUID = "...")] public class YoutubeBlock : BlockData { [Display(...)] [Required] [ValidYoutubeLink] public virtual string VideoUrl { get; set; } }
As an editor, I try to create a new shared block inside For All Sites folder.
In theory, Episerver should validate all the properties before executing EPiServer.DataFactory.Save()
https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/7/Validation/Validation/
But in practice, I can enter invalid values, click the Save button and go to next screen!
On the next screen, I'm able to click the Publish button. However, nothing happens when I do that. No validation errors in the edit mode, no meaningful errors in dev. tools console, nothing!