Copied to clipboard

Flag this post as spam?

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


  • iqb-dawn 21 posts 101 karma points
    Aug 26, 2022 @ 14:40
    iqb-dawn
    0

    Add Child Node From A Parent Children

    I have the following nodes,

    A | B | C Z | X | Y

    A have 2 child nodes (B and C). Z have 2 child nodes (X and Y).

    Now my nodes are dynamic. I wanna make sure B can only have child with name X and Y.

    So this will be valid in my case,

    A
      | B
         | X
         | Y
      | C
    Z
      | X
      | Y
    

    But this is not,

    A
      | B
         | X1
         | Y1
      | C
    Z
      | X
      | Y
    

    So, B can only have Z child's.

  • James Shelley 9 posts 103 karma points
    Aug 26, 2022 @ 14:47
    James Shelley
    100

    You can specify in the document type permissions which nodes of a certain template can be created beneath another template. If you browse to your document type, you can view this in the permissions tab.

    Node names beneath another node themselves have to be unique. if you have page B, and already have pages named X and Y beneath them, and want to prevent any further nodes from being created, you could hook into a page published event https://our.umbraco.com/documentation/reference/events/contentservice-events/

    Check for your parent node, and then check if child nodes X and Y already exist beneath it. If they do, you can prevent the page creation from happening and instead display an error message. Documentation for this method should be described in the above link.

Please Sign in or register to post replies

Write your reply to:

Draft