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 "https://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 "https://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 - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

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

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

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

    Reply
    • 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
  • This is in SharePoint designer 2010, how do we do it in SharePoint designer 2013

    Reply
  • 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
  • hi ,

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

    Regards,

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

    Reply
  • 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
  • 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
  • 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
  • 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
  • How can I read value of Manage Editable Field properties in Javascript and do according to value of that.
    Thanx.

    Reply
  • 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
  • Is it possible to make the field read only after first entry using jquery?

    Thanks

    Reply
    • 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
  • 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
  • Used the designer solutions, works great! Thanks for this post!

    Regards, Ralph Boccalini

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

    Reply
  • 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
    • True Sager,

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

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

    Reply
  • 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
  • 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

Your email address will not be published. Required fields are marked *