You’re right! The last time you gave me this idea, I did not quite understand what you meant, but it turns out it was very simple to implement. Thank you so much!
For the benefit of others reading this, here are all the steps needed to achieve what Ernst has suggested above:
- Add a Boolean checkbox field to the library called ‘Hide All’ with its default status as checked.
- Add another Boolean checkbox called ‘Hide Hide’ with its default status as checked.
- Add a dependency to both fields where it is only visible if the other one is unchecked.
- Now, whenever you want to hide a field from the user, add a dependency so it’s only visible when the ‘Hide All’ option is unchecked.
You can still change the value of hidden fields using scripts, but you cannot have them be the description, status or title of entries. If you want to make the value of a certain field the description, status or title of an entry without allowing the user (or, indeed, yourself) to edit it, create a calculation or JavaScript field that shows the value of that hidden field and use it for that purpose.
Now, if you ever want to see your hidden fields, you need to run the code “entry().set('Hide All', true)” from a script for all the fields in that library. You can create individual scripts in each library you have to do this, but I am outlining a better method below.
- Add a library and name it something appropriate (like ‘Configuration’ or ‘Settings’).
- Add a single choice drop down menu called ‘Library’ and allow yourself the ability to add items to it while editing. You can populate it with the exact names (including casing) of all your libraries where you are using the trick above.
- Add a Boolean checkbox called ‘Hidden Fields’ and set it to be checked by default.
- Save it and ensure that you do not share this library with your users (if any), unless you want to give them the ability to unhide your hidden fields.
- Add one entry each for all your libraries where you have hidden fields.
- Add a trigger script called “Update Settings” (or whatever) for the event “Updating an entry” and “After saving the entry”.
- In it, paste the following code and save it:
Now, whenever you want to show your hidden fields in any library to help you troubleshoot something, go into your Settings library and disable the Hidden Fields checkbox for the respective library. You can later build upon your Settings library by adding more configurable options for your libraries (like enabling/disabling notifications, etc.).
Once again, thank you, Ernst, for determinedly pointing me in the right direction.