Is there a way to change the EditForm in my SP 2010 site to display a dropdown column but as Read Only, so the user can not edit that column after the item has been created.I added the below code, but it works for textfield only, not for dropdown field.

Ref: here

What am I doing wrong?

function SetReadOnly()
   alert('inside setreadonly');
 var inputs = $$('input[title="Customer Name Required Field"]');
   if (null != inputs && inputs.length == 1) 
     var input = inputs[0];
     var label = "<span>" + input.getValue() + "</span>";
      Element.insert(input, {before: label});
        alert(' customername field is readonly  now');

   alert('inside setreadonly2 opportunity type field');
    var inputopporType = $$('input[title="Opportunity
     Type Required Field"]');
      if (null != inputopporType && inputopporType.length == 1) 
      var inputopporType = inputopporType[0];
        var label = "<span>" + inputopporType.getValue() + "</span>";
          Element.insert(inputopporType, {before: label});
       alert(' opportunity type field is readonly  now');
  • hi Jussi,as you suggested,I tried to edit the form, editform.aspx in SP D, but I am not able to find the field in the page & as I told earlier,my page is not responding now!.I am not able to add any content editor web part on the page. Can you pls tell why I am not able to add CEWP on this editform.aspx page?
    – samolpp2
    Oct 26, 2015 at 7:04

1 Answer 1


Instead of trying to set it as read-only, modify the EditForm.aspx with SharePoint Designer and change the control into <SharePointWebControls:FieldValue FieldName="MyField" runat="server"> control. It will then only render the current value.

  • thanks.But when I edited the form in SP D 2010 in one of my previous list forms - newform.aspx or editform.aspx, due to some reason, I am not able to add a content editor or CQWP or any OOTB web parts onto the page.So I didn't create a copy of this editform.aspx or touched the SP D.
    – samolpp2
    Oct 26, 2015 at 6:29
  • 3
    My suggestion was that you do not use your JavaScript code at all, just change the field from drop down into a field that only renders the selected value. Why show disabled drop down to the user as they cannot change it - better to just show the selected value.
    – Jussi Palo
    Oct 26, 2015 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.