Is is possible to validate the sections added to a page?
Assume I have a Document Type of "News Page" and within that is a property with a Nested Content editor. I then specify that the blueprint for the nested content allows 'child' document types of "Photo", "Text Block" and "Subheading".
Is there any way to specify that any of the 'child' document types are mandatory, or that the children should be added in a particular order (for example that subheading, if used, should appear first)?
I think that the answer is No, but thought I'd check in case I missed something!
As you guessed I am pretty sure that's a No. Nested Content is super dynamic and what your are describing sounds pretty static. May I ask you why need Sub Heading and Photo to be Nested Content and not just added directly to the 'News Page' doctype as standard properties? If they are mandatory and in a static order I mean?
Maybe The Grid could be a better fit for your project?
However should you really want to use Nested Content this way, I think you could use Saving events to validate if the current saving node has the appropriate child nodes and order, but that is a bit much to cover from an iPhone. :)
Ah, my bad. It sounded more static than it was. Appologies.
Maybe the save events could be an option? Where you catch the node being saved, validate its NC children and if incorrect, cancel the event and show a validation message? Thinking about it it sounds like a great package.. :)
Document Type validation
Hi,
Is is possible to validate the sections added to a page?
Assume I have a Document Type of "News Page" and within that is a property with a Nested Content editor. I then specify that the blueprint for the nested content allows 'child' document types of "Photo", "Text Block" and "Subheading".
Is there any way to specify that any of the 'child' document types are mandatory, or that the children should be added in a particular order (for example that subheading, if used, should appear first)?
I think that the answer is No, but thought I'd check in case I missed something!
Tim
Hi Tim.
As you guessed I am pretty sure that's a No. Nested Content is super dynamic and what your are describing sounds pretty static. May I ask you why need Sub Heading and Photo to be Nested Content and not just added directly to the 'News Page' doctype as standard properties? If they are mandatory and in a static order I mean? Maybe The Grid could be a better fit for your project?
However should you really want to use Nested Content this way, I think you could use Saving events to validate if the current saving node has the appropriate child nodes and order, but that is a bit much to cover from an iPhone. :)
Have a look at https://our.umbraco.org/documentation/reference/events/ContentService-Events
Best of luck to you!
Thanks for your reply Dennis,
The reason that Nested Content has been chosen is that we may have none, one or any number of each piece of content, and in any order (super dynamic!)
There was a discussion today that there may be some rules to apply if possible!
Regards,
Tim
Ah, my bad. It sounded more static than it was. Appologies.
Maybe the save events could be an option? Where you catch the node being saved, validate its NC children and if incorrect, cancel the event and show a validation message? Thinking about it it sounds like a great package.. :)
Or submit a feature request to Nested Content?
is working on a reply...