Making Field Read only in SharePoint 2010

Many times you need to disable the fields in SharePoint form for ‘New Item’. By using JavaScript we can disable field in easier way. Lets
discuss an example.

Using JavaScript

Find field id by inspecting element in browser’s developer tools. The filed id is something like this

Then write down few steps to disable it.

function DisableField()
    var element = document.getElementById('ctl00_m_g_efe2ea91_242b_4746_bb44_5a67e8cbc5c2_ff331_ctl00_ctl00_DateTimeField_')

Now you need to call the function ‘DisableField()’ on body load.

SharePoint gives out of the box functionality for JavaScript developer to inject custom function into function list of SharePoint function lists.

You can push ‘DisableField()’ function as follows.


Enjoy JavaScript…

One thought on “Making Field Read only in SharePoint 2010

Leave a Reply

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