Tuesday, January 13, 2015

CRM 2013 Javascript Disable form.


Script:

disableFormFields = function (onOff) {
    Xrm.Page.ui.controls.forEach(function (control, index) {
        if (doesControlHaveAttribute(control)) {
            control.setDisabled(onOff);
        }
    });
} //Function to disable all the field in the form// true/false

doesControlHaveAttribute = function (control) {
    var controlType = control.getControlType();
    return controlType != "iframe" && controlType != "webresource" && controlType != "subgrid";
} //Sub disableFormFields// Check the form have control like iframe, webresource or subgrid

function onload() {
     disableFormFields(true);
}

No comments:

Post a Comment