Copied to clipboard

Flag this post as spam?

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


  • Robert 63 posts 282 karma points
    Mar 27, 2015 @ 11:53
    Robert
    0

    Set default value Document type Property

    Hi,

    Is it possible to set a default value to a property of a document type?

    For example: I have the property to hide an item from the menu in the website (it's a checkbox). Is it possible to set the default value to checked?

    Kind regards, Robert

  • Sören Deger 733 posts 2844 karma points c-trib
    Mar 27, 2015 @ 12:00
    Sören Deger
    2

    Hi Robert,

    you can use the ContentService-Events to do this: 

    https://our.umbraco.org/documentation/Reference/Events-v6/ContentService-Events

    If you will set this property only if the item is brand new, then use the Saving event and the HasIdentity property.

     

    Cheers,

    Sören

  • Bjarne Fyrstenborg 1286 posts 4060 karma points MVP 8x c-trib
    Mar 27, 2015 @ 13:02
    Bjarne Fyrstenborg
    101

    Hi Robert

    Another approach could be to take a look at my package https://our.umbraco.org/projects/backoffice-extensions/switcher where you can choose to set the default / initial value to true (checked/active).

    /Bjarne

  • Robert 63 posts 282 karma points
    Mar 27, 2015 @ 16:50
    Robert
    0

    That looks good! I'm gonna try that, thanks!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies