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.
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.
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:
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!
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?
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
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
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
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
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
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!
is working on a reply...