Copied to clipboard

Flag this post as spam?

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


  • Paul Griffiths 370 posts 1021 karma points
    Jul 22, 2016 @ 18:43
    Paul Griffiths
    0

    Is it possible to disable an umbarco doc type property?

    Hi All,

    Is it possible to disable a property on a document type to prevent the user from updating the value?

    Im using Umbraco version 7.4.3

    many thanks Paul

  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Jul 22, 2016 @ 22:01
    Marc Goodson
    1

    Hi Paul

    What kind of property ? - if the property is a TextString, you could just change the underlying DataType for the property to be a 'Label'

    The value will still be displayed, and be usable in your templates, but the editor will not be able to change the value.

    If however your property is more complex, eg a content picker, the value of the picked item would still be uneditable and displayed in the label, but this might be an Id rather than a meaningful list of picked items.

    regards

    Marc

  • Paul Griffiths 370 posts 1021 karma points
    Jul 23, 2016 @ 05:53
    Paul Griffiths
    0

    Hi Marc,

    Thanks for the reply.

    The property that I'm trying to disable is a data type that I created based off a dropdown list. I have entered some prevalues and made the new property available on a document type that I created.

    I want to set the value and then disable it so that the value can't be changed by an editor. I was thinking whether it was possible to disable this to a particular user group etc.

    Thanks Paul

  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Jul 23, 2016 @ 08:50
    Marc Goodson
    1

    Hi Paul

    If it's a one time change, or not very often change, then you could switch the dropdown to a label, the value will be preserved, but you'll have to switch it back to a dropdown temporarily to edit it - not ideal!!

    Permissions in Umbraco do not apply to individual properties out of the box.

    There is a package in 'beta' that enables showing and hiding of tabs and properties based on a UserType:

    https://our.umbraco.org/projects/collaboration/backoffice-tweaking/

    (I haven't used it)

    which sounds like the flexibility you are after.

    Other options, are:

    if it's a site setting, you could create a 'configuration' document type containing the setting and then restrict permissions so only admins could update/publish that document type.

    If it's kind of a per page setting, then either you can create a custom property editor, that checks the role of the current editor, and only enables the dropdown if they are admins - (https://our.umbraco.org/documentation/tutorials/Creating-a-Property-Editor/)

    or another approach would be to tap into the Saving Event of the page, and again check the role of the person saving and if the setting had changed, and if the person wasn't an editor - then cancel the saving event with a custom message saying "please don't change that dropdown - ask Paul"

    or send an email alert to admins if the property changes in case in some circumstances it's fine for editors to change it!

    https://our.umbraco.org/documentation/reference/events/contentservice-events

    regards

    Marc

  • Paul Griffiths 370 posts 1021 karma points
    Jul 30, 2016 @ 14:50
    Paul Griffiths
    0

    Hi Marc,

    Thanks for all the information above. Really useful!

    Ill check out the package and see if there is anything in there i can use :)

    Thanks

    Paul

  • Jon R. Humphrey 164 posts 455 karma points c-trib
    Jul 30, 2016 @ 19:33
    Jon R. Humphrey
    0

    Paul,

    Everything that Marc has said is golden but instead of changing the field to a label I would instead check the role of the editor and then manipulate a "disabled" attribute on it?

    http://www.wufoo.com/html5/attributes/30-disabled.html

    Mind you this would be easiest via a custom property editor of course!

    Hope this helps!

Please Sign in or register to post replies

Write your reply to:

Draft