Category Archives: Disable Form Fields

Disable Form Fields in CRM 2011

How to Disable Form Fields in CRM 2011

This article is different from the previous one. This time, we are going to disable all the fields on a form in CRM 2011. The sample Java script is shown below.

function disableFormFields(onOff) {
Xrm.Page.ui.controls.forEach(function (control, index) {
if (doesControlHaveAttribute(control)) {
control.setDisabled(onOff);
}
});
}

function doesControlHaveAttribute(control) {
var controlType = control.getControlType();
return controlType != “iframe” && controlType != “webresource” && controlType != “subgrid”;
}

Advertisements

Leave a comment

Filed under Disable Form Fields, MS Dynamic CRM 2011