- make a text field readOnly: my first attempt is by setting the disabled property to true with no success, the correct answer is document.getElementById(‘your_control_id’).readOnly = true;
- make a checkbox field readOnly is more complicated, the readOnly property doesn’t exist/work, so I keep on researching and finally have this:
if (document.getElementById(‘your_control_id’).type == “checkbox”)
document.getElementById(‘your_control_id’).onclick = makeReadOnly;
- I am unable to make a textarea field read only (I will try again later)
Works great for simple form behavior handling but if a form get really complicated e.g. data validation, dynamic value, I would suggest building an ASP.NET control or Infopath form rather than adding logic on the SharePoint Display/Edit/New forms.