Custom validation on TitlePart #16816
-
I have a ContentType which just has a TitlePart attached to it. I would like to ensure that the title on the TitlePart is unique when compared to other contentItems of the same ContentType. I have tried to override the ValidatingAsync methods on a custom ContentHandlerBase class where I can hook into the CreatedAsync override but ValidatingAsync doesn't get hit when creating the content item. I have also tried to create a custom ContentPartHandler but none of the overrides (CreatedAsync, ValidatingAsync etc...) get executed. I have registered with DI with
Is this expected behaviour? Any help on how I might hook into the TitlePart validation to achieve the desired result would be great. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You need to register handlers with the Most possibly the |
Beta Was this translation helpful? Give feedback.
-
For Admin UI, Validation happens in display drivers, use display driver for validating your custom part, make sure you add validation error to ModelState. You could reuse logic of |
Beta Was this translation helpful? Give feedback.
For Admin UI, Validation happens in display drivers, use display driver for validating your custom part, make sure you add validation error to ModelState. You could reuse logic of
ValidatingAsync
by calling from within your driver