Solution: Open Sharepoint Designer, select “Lists and
Libraries” then select the list, then select “EditForm.aspx” from “Forms”
panel.
Select “Advanced Mode.”
Click “Preview in Browser” and set the value in the field to
something distinctive (e.g. “Wokka Wokka”)
From the browser, select “View Source” and search for the
distinctive text.
You will see something like this:
<input name="ctl00$TextField"
type="text"
value="wokka
wokka" maxlength="255" id="ctl00_ctl00_ctl00_TextField"
title="Title"
class="ms-long
ms-spellcheck-true" /><br />
Copy the value in “id” into the text below, then go back to
Sharepoint Designer and append that text at the bottom of the EditForm.aspx
file.
Click Preview In Browser again and the field should be read
only.
<asp:Content ID="Script" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/javascript">
function setControlReadOnly()
{
var elements=document.getElementById('ctl00_m_g_19d74208_fb82_4a74_a3b0_0c5d16ec6591_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField');
if (elements == null)
{
alert("Could not set control to read only.");
}
elements.readOnly=true ;
}
<script type="text/javascript">
function setControlReadOnly()
{
var elements=document.getElementById('ctl00_m_g_19d74208_fb82_4a74_a3b0_0c5d16ec6591_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField');
if (elements == null)
{
alert("Could not set control to read only.");
}
elements.readOnly=true ;
}
_spBodyOnLoadFunctionNames.push("setControlReadOnly")
</script>
</asp:Content>
</script>
</asp:Content>