GUI Extension: Readonly and hidden fields in Tridion 2011 and up
Adding read-only support for Component Fields was available in Tridion 2009 and in this post I partially bring it back to Tridion 2011 and 2013 using a new GUI Extension. Tridion provides an intuitive and easy to use interface for editing and creating content, technically known as the ComponentView. Sometimes we have fields that are read-only and receive data from an external system. For example, the developer might have written a core service application that imports content from an existing product database, for example, and we do not want authors changing that data in Tridion.
This solution extends the Tridion GUI and uses a schema field description naming convention, [readonly] or [hide], to change the behavior of the Tridion ComponentView GUI. The read-only fields solution was first created by Yoav Niran a few years ago for Tridion 2009 and is available on his blog here.
In this article I will provide the solution files and instructions for deploying to Tridion 2011 and 2013.
- Install GUI Extension
- Update Schema Descriptions and put [readonly] or [hide] in Schema Field Description
Fields currently supported: (only General Content tab)
- Component Link
- Metadata fields – Thanks to Alex Klock for the solution on the Tridion StackExchange
Looking for help with: (and welcoming community contributions)
- Find out why GUI Extension does not work when Tridion GUI Minification is enabled
- Add support for additional field types. I assume I need additional jQuery selectors to get the appropriate div container and then disable it.
I got stuck many times while building this extension and the Tridion Community got me unstuck each time. Special thanks to UI Beardcore, who wrote most of the code that is in this post via this Tridion StackExchange post.
Files for downloading (Gist):
Instructions for deploying:
1. Create a new folder for the GUI Extension on the CMS Server: C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\Editors\Readonly
2. Copy Readonly.config, Readonly.js, and jquery-1.10.0.min.js files to the folder created above.
…type=”Tridion.Web.UI.Resources.Filters.JScriptMinifier, Tridion.Web.UI.Resources.Filters” enabled=”never”
- This is a known issue and I am hoping the community can help me find a solution.
4. Enable the GUI Extension in the System.config
Add the following to the file ‘C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\Configuration\System.config’
C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\Editors\Readonly Readonly.config
File source code, 3 files:
3. Download the jQuery file
Many things are possible with GUI Extensions and with the right knowledge from the Tridion Community we can achieve a lot. While most of this code is front-end code in the realm of front-end developers, the CMS backend developers are often working directly with Tridion users and thinking how to improve their experience of editing and maintaining content. Collaborating with other front-end developers on these GUI Extensions is the magic that makes these things possible.
Author: Robert Curlette
Robert organizes the Tridion Developer Summit, likes teaching workshops on SDL Tridion, and helps customers implement solutions with SDL Tridion, DD4T, and Alchemy GUI Extensions. If you would like help, please contact me.
We would like to help you in developing your SDL Tridion websites with our extensive knowledge of the Tridion Architecture, APIs and Tridion Upgrades. Robert Curlette leads our team in Sofia, Bulgaria and is a 5 time SDL Tridion MVP award winner.
We believe in the strong Tridion community and organized the first Tridion Developer Summit, teach courses on SDL Tridion, and regularly blog about SDL Tridion solutions.
Contact us to find out how we can help you today.