Copied to clipboard

Flag this post as spam?

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


  • Marcus 42 posts 183 karma points
    Dec 07, 2023 @ 03:39
    Marcus
    0

    Creating content directly from content picker while creating another content

    Umbraco 12.2.0

    Hi guys. Does umbraco allow to create content while editing another content?

    For example:

    I have document types called "Book" and "Category". Book has a property is Categories (Multi node picker). Anytime I want to create a content of book I have to create many categories first.

    Is it possible to create category while creating/editing a content of book?

    I am new with umbraco. Thanks for any help

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Dec 09, 2023 @ 23:17
    Marc Goodson
    100

    Hi Marcus

    The multinode tree picker doesn't allow you to create new entries, in the list of content nodes you are picking from, as you have found!

    The Tags data type allows similar behaviour. In that the editor can add 'free form' text eg new categories. but as they type, previously entered tags are suggested, so they don't need to be retyped each time... But the categories are stored as tags in the database not as Umbraco content items...

    You could create a custom property that has the multinode tree picker but also a textbox and a button which would send the new category to a custom API endpoint that would use the ContentService to create the new Category Node and return it's Id, update the multinode tree picker with the new category picked...

    ... Or a hackier version of this could be to add a textbox next to the multinode tree picker to add your new categories and then write code to handle the saving notification when the page is saved and published..

    https://docs.umbraco.com/umbraco-cms/reference/notifications/contentservice-notifications

    You could take the new values from the textbox. Use ContentService to create the categories and update the multinodetree picker to have picked them and blank out the new category textbox... It's a bit hacky but quicker to put together!

    Regards

    Marc

  • Marcus 42 posts 183 karma points
    Jan 17, 2024 @ 03:54
    Marcus
    0

    Thank you Marc.

    I can handle by using Repeatable Text Strings and create multiple categories in my custom notification.

    But our client prefers the solution of creating new Data type which has textbox in multi node tree picker you suggested. I also like it as well :))

    Could you list more detail what we need to do for creating new data type?

    Thank again!

Please Sign in or register to post replies

Write your reply to:

Draft