How to Make SharePoint List Column (Form Field) Read Only?

How to make a column read only in SharePoint 2010? Well, there are many ways. Here are some:

  1. Make column read only in SharePoint list programmatically
  2. use jQuery to make SharePoint field read only
  3. Using SharePoint Designer to set field read only in list forms.

Programmatically Set SharePoint list field to Read-Only using C# object model code or PowerShell script: 

To make a SharePoint field read-only, We can set the ” ReadOnlyField” property of SPField to “True” using either PowerShell script or C#
code. Here is how: 

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the Web
$web = Get-SPWeb "http://sharepoint.crescent.com/sites/pmo"
#Get the List
$List = $Web.Lists["Project Metrics"]
#Get the Field 
$Field = $List.Fields["Project ID"]
#Set the field to Read only
$Field.ReadOnlyField = $true
$Field.Update()

See the detailed implementation at: Hide Columns in SharePoint List NewForm, EditForm, and DispForms.

But the problem is: As soon as you set “ReadOnlyField” to true, the field will be hidden from all list forms and list settings. Instead, make the “ShowInNewForm” and “ShowInEditForm” Properties to False to hide them from NewForm.aspx and EditForm.aspx but still make it visible on list settings and DispForm.aspx.

Alternatively, you can create a Field with ReadOnly Property and add the field wherever required.

$SPSite = Get-SPSite "http://sharepoint.crescent.com"
$SPWeb = $SPSite.RootWeb
$SPcolumn = '<Field Type="Number" DisplayName="Project ID" Required="FALSE" 
               ReadOnly="TRUE" ShowInDisplayForm="TRUE"ShowInViewForms="TRUE" EnforceUniqueValues="FALSE" 
                  Indexed="FALSE" Min="1" Max="10000" Group="Crescent PMO Site Columns" 
                    ID="{b81c7da6-1317-46fa-a32b-9f446c30b6e9}" StaticName="ProjectID" Name="ProjectID"></Field>'
$SPWeb.Fields.AddFieldAsXml($SPcolumn)

See more at: Create Site Column Feature for SharePoint 2010

However, these methods not satisfying our requirements. What we want is the field to be present in all SharePoint list forms with “Read-only” mode! So, let’s see help from jQuery solution.

Make a SharePoint List form field read only with jQuery 

To make a column read only, Place the below code in a text file, upload to any SharePoint library, add a CEWP to the “NewForm.Aspx” and/or “EditForm.aspx” or wherever required. Specify this script as “Content Link” from the content editor web part properties panel.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"
       type="text/javascript"></script>

<script type="text/javascript">

$(document).ready(function()
{
//Set the Field to Read only and change its background colour
$("input[title='Metrics ID']").attr("readonly","true").css('background-color','#F6F6F6');
//You can disable the field also:  $("input[Title='Metrics ID']").attr("disabled", "disabled");
});

</script>

Output goes like this: SharePoint 2010 read only field in edit form

sharepoint make field readonly in editform

To disable a Choice field (Drop Down) use:

$("Select[Title='Department']").attr("disabled", "disabled");

To Disable Multiline Plain text fields

$("input[Title='Description']").attr("disabled", "disabled");

How to make a field read only in SharePoint Designer?

To make a SharePoint list column read only in EditForm.aspx, follow these steps:

  1. Open the SharePoint site in SharePoint Designer
  2. Navigate to the List. Under the “Forms” section, click on “New”
    how to make a field read only in sharepoint designer
  3. Create a new EditForm by giving it a name, and choosing other properties in the below screen.
    sharepoint designer 2013 read only field
  4. Edit the newly created Edit form in SharePoint Designer, Click on the target property to select
  5. Change the “DisplayMode” property from “Edit” to “Display” in the properties pane.
    sharepoint designer 2010 make field read only
  6. Save and close.

Output: Read only field in SharePoint list form using SharePoint Designer

sharepoint designer 2010 read only column

Years back, there was a similar requirement for SharePoint 2007 and I used JavaScript: Make Read-Only fields in SharePoint List Forms using Javascript

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

25 thoughts on “How to Make SharePoint List Column (Form Field) Read Only?

  • January 29, 2020 at 4:17 PM

    I want to give column level permission in sharepoint 2013 list?

    Reply
  • October 5, 2019 at 9:29 PM

    Thanks! It helped. You saved me from my boss.

    Reply
    • November 26, 2019 at 11:33 PM

      Hi anil: I tried this script. But it didnt work for me. Can you let me know that how did you do it? thanks

      Reply
  • September 28, 2018 at 7:55 PM

    This is in SharePoint designer 2010, how do we do it in SharePoint designer 2013

    Reply
  • December 11, 2017 at 9:18 PM

    If you need a non-code solution: If I want to make “Country” read-only, I add a field “CountryReadOnly”. Type: Calculated field. Value: Country field. Then I hide the field Country in the content type. Deny users the right to create views.

    Reply
  • August 23, 2017 at 8:33 AM

    hi ,

    if any possible way to Disable Multi line Rich text fields using java script(like above )

    Regards,

    Reply
  • April 25, 2017 at 2:47 PM

    Is it possible to modify the field properties directly from SharePoint site settings or SharePoint Designer without touching the Form ?

    Reply
  • July 26, 2016 at 4:06 PM

    The code you provided doesn’t work for my Choice input. I’ve tried this before and it didn’t work. However, other approaches for selection have worked using jQuery. I just want to say I like your thorough explanation and screenshots, it makes everything very clear.

    Reply
  • April 15, 2016 at 5:27 PM

    Good Day,

    The jQuery code isn’t working for some reason, I even insert a column with the name Metrics ID to test it. Can you help me? The name of the column I want as read only is ‘Country’. Is there a limit as to the amount of columns that can be made read-only as well?

    Thanks

    Reply
  • January 18, 2016 at 11:29 PM

    Hi,
    How can I set column level permissions ? For instance, certain columns hidden to some users or read only but open for edit for some folks.

    Reply
  • October 28, 2015 at 2:43 PM

    I cannot get the jquery to work. I did the directions above. Any ideas why? I added as a content editor webpart above the list web part

    Reply
  • October 8, 2015 at 6:55 AM

    How can I read value of Manage Editable Field properties in Javascript and do according to value of that.
    Thanx.

    Reply
  • September 9, 2015 at 3:55 AM

    Thank you for this solution. The above code works great when it is a single line but fails when it is multiline text column. Can you please advise. NK

    Reply
  • September 26, 2014 at 11:31 PM

    Is it possible to make the field read only after first entry using jquery?

    Thanks

    Reply
    • February 26, 2016 at 5:39 PM

      Hello, I also need to do the above. I want a specific field to be editable at first and then mark the field as read only. Would really appreciate the help!

      Reply
  • August 8, 2014 at 3:27 PM

    This script is not working on the Datasheet view, could you please modify the script duly to accommodate that as well?

    Thanks in advance

    Reply
  • May 6, 2014 at 12:12 AM

    Used the designer solutions, works great! Thanks for this post!

    Regards, Ralph Boccalini

    Reply
  • April 5, 2014 at 5:40 PM

    I need to disable a text box based on the dropdown selected. Can u help me in this??

    Reply
  • February 17, 2014 at 9:37 AM

    Using Jquery it works..but its still possible to alter the text by enabling the field from read only to editable using developer toolbar and then the field value can be changed. Do you have any idea how to prevent it?

    Reply
    • February 17, 2014 at 1:53 PM

      True Sager,

      jQuery/JavaScript methods are weak! Use either PowerShell/C# methods to set field Properties to read-only.

      Reply
  • November 25, 2013 at 5:55 PM

    I used your SharePoint Designer solution and it worked perfectly. THANK YOU!

    Reply
  • September 3, 2013 at 1:29 PM

    Hello,

    i used the jquery solution and it worked fine. How must be the code if i wanna set more than one column as read only?
    Hope you can help me
    Thanks in advance
    Tj

    Reply
  • September 3, 2013 at 1:58 PM

    Hi,

    that’s a great solution. Is it possible to make look-up columns and people picker as read only. This are the only types of columns where the code doesn’t work.

    Thx for your help

    Reply

Leave a Reply