Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim Watts 90 posts 395 karma points
    Feb 01, 2017 @ 15:12
    Tim Watts
    0

    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

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Feb 01, 2017 @ 18:20
    Dennis Adolfi
    0

    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?

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Feb 01, 2017 @ 18:23
    Dennis Adolfi
    1

    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!

  • Tim Watts 90 posts 395 karma points
    Feb 01, 2017 @ 18:37
    Tim Watts
    0

    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

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Feb 01, 2017 @ 18:52
    Dennis Adolfi
    0

    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?

Please Sign in or register to post replies

Write your reply to:

Draft