How to use Java Script to make fields on a PDP read only

Environment: Project Server 2010

Background: This can be achieved out of the box via a stages in a workflow; however, in some cases workflows are not in use or like this one the fields are being populated via some integration so we don’t want them to be read only to the integration – just to stop users overwriting the synchronized values, thereby, we have used the JavaScript solution to make the fields read only on a PDP page.

Solution Steps:

Steps 1: Insert a content editor webpart on the page , note: content editor web part should always be placed below the webpart which contains the Enterprise custom fields you want to disable.

Step 2: Edit The HTML For Content Editor Web Part, copy and paste the code as below, make sure to change the Name  of the Enterprise Custom field and you are done:)

<script type=”text/javascript”>

function MakeReadOnly()


// 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==”Custom Field Name”) //Field name



Hope this helps.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

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

Google+ photo

You are commenting using your Google+ 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

%d bloggers like this: