I have a 3 property with rich text editor in my cm...
# help-with-umbraco
b
i want to add my own validation logic like at least one of 3 items must be filled and A 'required' notification must be given with user feedback to add content on one of the fields. The item cannot be published (it will be saved) until the content is there
s
You can use a
NotificationHandler
to prevent publishing and show error messages/hints. https://docs.umbraco.com/umbraco-cms/reference/notifications Alternatively you could make it a block list in which they can only pick rich text editors and you set the minimum number of items to 3. I guess that won't work because your requirement is that they need to add content. Please be aware that if you require things from editors and they don't agree with you, they will just leave the 3 items blank (or put a space or a
.
in it) to meet the requirements. Always be very careful making things "mandatory" - editors can get annoyed and work around your rules. 😅
b
suppose i have 3 items in my cms eg: sypniosis, opinion and concliusion , so when i leave the sections empty it should show a Required Notification , i meant this also at least 3 items must be filled , so do i need to use NotificationHandler?
s
I think you might be able to get there with the block list, give it a try
Otherwise a notificationhandler but that one doesn't mark individual properties as required
b
i will have to create a custom rich text property editor but i dont know how..?
s
It's not a very feasible solution. Try with the block list though, pretty sure that should work.
b
okay so i have to create a datatype and add label for the valiadation and logic? and use that ?
s
It sounds like your pretty new to block lists so I would encourage you to read up on them first: https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor/block-list-editor My suggestion would be: - Add new property to doctype of type block list editor - Allow min 3 blocks - Each block only has a single required RTE Think that should work.
b
i understand, i just want to implement a custom Validation in the content field , im currently using rich text editor in the items (sypnosis, opnion and conclusion) so what should i do to add some logic like : synopsis, opnion, conclusion: at least one of the 3 items must always be filled. and a A 'required' notification must be given with user feedback to add content on one of the fields. The item cannot be published (it will be saved) until the content is there , thanks for helping me out, hope u understand..
s
aaah at least one, thought they were all mandatory.. no then I would fall back to notfication handlers and pop up a message if not enough of them are filled in and cancel the publish operation.. making a custom property editor with RTEs might be possible but too far out of my comfort zone to even know where to begin