Home > CRM 2011, JScript > Disabling form in CRM 2011

Disabling form in CRM 2011

Hi,

Here is the Jscript code to disable the CRM Form (i.e., Fields on the form)

function doesControlHaveAttribute(control){

var controlType = control.getControlType();

return controlType != “iframe” && controlType != “webresource” && controlType != “subgrid”;

}

function disableFormFields(truefalse){

Xrm.Page.ui.controls.forEach(function(control, index) {

if (doesControlHaveAttribute(control)){

control.setDisabled(truefalse);

}

});

}

How do I call this?

  • To disable Form  – disableFormFields(true)
  • To Enable Form  –  disableFormFields(false)

Hope it Helps 🙂

Advertisement
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: