Read only field in SharePoint EditForm.aspx

Using JavaScript

First find out the tag corresponding to the input field which would like to set as read only

For this open up the editform.aspx page right click it and select view source

Say this is the tag of the input field

<input name=”TextField” type=”text” value=”Approved” maxlength=”255″ id=”4_ctl00_ctl00_TextField” title=”Status of Idea” class=”ms-long” />

Now open your editform.aspx page in SharePoint designer and add the following script to it

<script type=”text/javascript”>

function SetReadOnly()


// find all the elements with tag Name as INPUT

var elements=document.body.getElementsByTagName(“INPUT”);

// loop through all the elements till we find an element with type text and title as name of our field

for (index=0; index < elements.length;++index)




if(elements[index].title==“Status of Idea”)










<script type=”text/javascript”>

function SetReadOnly()


var elements=document.getElementById(‘4_ctl00_ctl00_TextField’);





Or using event handler as mentioned over here


Using CAML

And to hide button say OK button than

function SetHidden()
var x=document.getElementsByTagName(“input”);
for (var i=0;i<x.length;i++)
if (x.item(i).type==”button”&&x.item(i).value==”OK”)
x.item(i).style.display = “none”


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

19 thoughts on “Read only field in SharePoint EditForm.aspx”

  1. this was a great post. I have found it difficult to find a script that does not lose its value on post back, so now I am curious. How can this be applied to other field types like Select (lookup and dropdown). i have tried using the by ID, but not luck. Also tried to add multiple fields, but got an error.


  2. Great post, some of my customers have used this scripts to add collaboration content to LOB data in SharePoint lists with the help of the SharePoint Business Data List Connector.

    Thanks again, Regards.


  3. I have tried every variant of the javascript examples above that I can imagine and cannot get this to work. I even tried modyifing a similar “hide field” function(see below_ that is working but to no success.


    function findacontrol(FieldName) {
    var arr = document.getElementsByTagName(“!”);
    // get all comments
    for (var i=0;i 0)
    { return arr[i]; }
    function hideFields() {
    var control = findacontrol(“Owner Email Sent”);”none”;

    I’m desperate to make some fields on my editform.aspx read only using javascript – any help\recommendations would be greatly appreciated!!!


  4. It’s very helpful post. Thank you.
    May I have a question…?
    If I need to re-write / modify the read-only field in the list of SharePoint, how should I do?
    For now, I use MS Access to do data query and want to sync back to SharePoint.
    Some of read-only fields in the list will occur error message to tell me it can’t be modified.
    For example: Content Type, File Type, Modified, Created, Modified By, Created By…etc.
    Thank you


  5. Hey there, my name is Uwe and I’m a fellow blogger out of Wuppertal Elberfeld, Germany. I’m
    glad to see the work you’re doing on this site. Coming upon Read only field in SharePoint EditForm.aspx | Nishant Rana’s Weblog was refreshing and helpful in terms of writing and work.

    Carry on the nice work guys: I’ve incorporated you guys to my blogroll.
    I think it will improve the worth of my own blog.


  6. I am new to the sharepoint customisation and wanted to try this solution to make certain fields in a list read only, can you please specify which part of the page needs to be modified, step by step instructions will be awesome..thanks for help in advance


Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

CRM for You and Me

Customer Relationship Mgt App for the Professional

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog

Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform


Specific topics by Django Lohn on the whole Microsoft365 Stack

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions


Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue MVP

A Microsoft Business Applications MVP

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

Two Bite Tips

Valuable Tips To Grow Your Business

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM


Mail to for queries and suggestions

Giving back to the community what I have learned

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.

CRM Keeper

Dynamics 365 Customer Engagement, CRM, Microsoft CRM, Dynamics CRM


Step into the world of a Dynamics 365 Consultant

Dianamics PCF Lady

Diana & Dynamics 365 & Power Platform

Sara Lagerquist

No Code Customization Concepts


developer, designer, writer, fun loving, patriotic, humble and a sweet person inside out :) love and respect people who have a great sense of humor.

Temmy Wahyu Raharjo

Dreaming to be a clean coder and TDD minded programmer.

Transform 365

We blog about problems we face and code we write to help others

%d bloggers like this: