This script works on SharePoint 2013, 2016 and Online. I heard it works on 2010 as well, though I haven’t had much experience with it there. Let me know!
UPDATED 2/28/15 fix a few bugs as noted in the comments.
UPDATED 10/22/15 fix disableWithAllowance and people pickers.
UPDATED 10/23/15 fix disable and disableWithAllowance and metadata fields.
UPDATED 5/24/16 fix issue with disabling Lookup Fields, now will show correct value.
UPDATED 8/1/2016 fix issue with disabling choice fields as radio buttons, now will show the single selected value.
UPDATE 9/27/2017 not really a fix, but moving from CodePlex to GitHub
The script is here: download from GitHub.
How to use it
Include the script along with jQuery on your page. Ideally, throw this nugget into your master page and you can use it anywhere in your site.
Once that’s in, get using it! It’s really simple, I threw this on my new form for my task list:
This will change our New form for a typical task, from:
See the difference? It’s subtle, but when working with end users, it can provide a huge benefit to help streamlining your business flow.
From here, you could have the edit form disable or hide a lot of the fields for normal users, only allowing your Project Managers, or if this is a support request list, your Support Team access to modify fields as needed. The options are endless.
Simply disables the field, for all users. It hides all controls in the field and displays the value instead.
Disables the field, but enables it for the users in the groups specified. Also, Site Collection Administrators are included automatically, so they can always edit the field. You can send the groups in an array, like [“Group One”, “Group Two”].
Simply hides the field, for all users.
Hides the field, but shows it for the users in the groups specified. Also, Site Collection Administrators are included automatically, so they can always edit the field. You can send the groups in an array, like [“Group One”, “Group Two”].
Some other important notes
- Currently, this script does not work on list views, meaning a user could edit the data in datasheet/quick edit view.
- This script should work just as well on SharePoint 2010 if you so desire.
Download this script here: download from GitHub.
Til next time, Happy SharePointing!