November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I'm having the exact same issue. It kind of renders validation pointless if the end users have no idea what they're doing wrong
Episerver has confirmed that this is a bug, this is the answer I got from their support:
A bus is reported for this issue.
CMS-2385:UI not showing error message when creating a block from a content area
The bug will be made public after initial triage meeting. You can then follow it up throughhttp://world.episerver.com/support/Bug-list/
Thanks for reporting this issue.
I emailed Episerver to ask when this would be fixed, and this time they told me the bug had been closed as "won't fix" as it will work if you also set the property name. So there is a way to fix it which is great, hopefully they'll update the documentation as well so more people won't get stuck on this.
annelie
How do you mean if you also set the property name? Could you reply with an example? Really appreciate the update though!
No problem! When you create the validation error, set the property name as well and the error will show up. Here's an example:
public class TestValidation : IValidate<MyBlock> { public IEnumerable<ValidationError> Validate(MyBlock instance) { return new List<ValidationError> { new ValidationError { ErrorMessage = "There is an error", PropertyName = "MyBlockError" } }; } }
Ah okay, I didn't know you could do that (to be fair I never looked). That'll work perfectly, although perhaps a bit of a shame if your error concerns multiple properties?
Actually, there's a RelatedProperties property where you can specify a string array for that case.
I'm having problems with the validation error messages not showing when they should. I've created a custom validation class for a block type that inherits from IValidate, and while the validation is working fine the error message isn't always shown. If I create a new block from the assets pane the error message is shown as it should, but if I click the "create a new block" link in a content area it's not displayed. Is this a bug or have I missed something?