While disabling fields from 1st method, some lookups, radio buttons and date fields may not get disabled, you have to disable them separately
// This loops through all elements of CRMForm, faster and consumes less memory
function disableFields(disableenable)
{
var CRMObjects = new Array(CF.,CF.,CF.,CF.);
for (i=0;i < CRMObjects.length;i++)
{
CRMObjects[i].Disabled=disableenable;
}
/*now disable all active form elements*/
for (i=0; i<>0)
{
if(crmForm.elements[i].Disabled==false)
{
crmForm.elements[i].Disabled=disableenable;
}
}
}
Another way................. this takes more memory as it takes all elements of the HTML of CRM form
//---------------------------------------------------------------------------------------------------
var iLen = crmForm.all.length;
for (i = 0; i < iLen; i++)
{ o = crmForm.all[i];
switch (o.tagName.toLowerCase())
{ case "input":
case "select":
case "textarea":
case "img":
case "iframe":
case “div”:
o.Disabled= true;
break
default:
break;
}
}
//---------------------------------------------------------------------------------------------------
// This loops through all elements of CRMForm, faster and consumes less memory
function disableFields(disableenable)
{
var CRMObjects = new Array(CF.
for (i=0;i < CRMObjects.length;i++)
{
CRMObjects[i].Disabled=disableenable;
}
/*now disable all active form elements*/
for (i=0; i<>0)
{
if(crmForm.elements[i].Disabled==false)
{
crmForm.elements[i].Disabled=disableenable;
}
}
}
Another way................. this takes more memory as it takes all elements of the HTML of CRM form
//---------------------------------------------------------------------------------------------------
var iLen = crmForm.all.length;
for (i = 0; i < iLen; i++)
{ o = crmForm.all[i];
switch (o.tagName.toLowerCase())
{ case "input":
case "select":
case "textarea":
case "img":
case "iframe":
case “div”:
o.Disabled= true;
break
default:
break;
}
}
//---------------------------------------------------------------------------------------------------
Comments