Disable CRM 3.0 TABS Completely
Sometimes you like disable the tabs on CRM 3.0 entity completely depending upon certain conditions.
Below is the script that will just do that for you.
/**********************************/
//Author : Ashwinikumar
//Discription : Disables Tabs
/**********************************/
var TabIndex = 1; //Specify the Tab index where the fields will be disabled, should be >=1
//Disable the Tab
function DisableTabs()
{
try
{
//Check if Tab exists
if(document.getElementById("crmTabBar"))
{
var GetNode = document.getElementById("crmTabBar").parentNode.parentNode.nextSibling.firstChild; //Get the Main Tabs
var GetTab = document.getElementById("tab"+(TabIndex-1)).getElementsByTagName("TD")[0];
var FirstChild=GetTab.firstChild; //Get the first child instance
var IFrame = document.createElement("iframe"); //Create a frame
var IFrameInstance; //Holds the frame created
GetNode.attachEvent("onresize",SetIframeSize);
IFrame.setAttribute("id","CEICustomIframe"); // Set the frame Id
//Check if frame is already rendered
if(document.getElementById("CEICustomIframe") == undefined)
{
GetTab.insertBefore(IFrame,FirstChild); //Insert the frame in the Desired Tab as first child
}
//Set frame attributes
IFrameInstance = document.getElementById("CEICustomIframe");
IFrameInstance.style.filter="Alpha(Opacity=2)";
IFrameInstance.style.position="absolute";
IFrameInstance.style.visibility="visible";
IFrameInstance.frameBorder=1;
IFrameInstance.style.height = GetNode.clientHeight;
IFrameInstance.style.width = GetNode.clientWidth - 14 //minus 14 so that scroll bar is accessible;
}
}
catch (e)
{
alert(e.message);
}
}
//Set the width the IFrame each time the Tab width resizes
function SetIframeSize()
{
if(document.getElementById("CEICustomIframe"))
{
var GetNode = document.getElementById("crmTabBar").parentNode.parentNode.nextSibling.firstChild; //Get the Main Tabs
IFrameInstance = document.getElementById("CEICustomIframe");
IFrameInstance.style.height = GetNode.clientHeight;
IFrameInstance.style.width = GetNode.clientWidth - 14; //minus 14 so that scroll bar is accessible
}
}
function DisableFields(TagName)
{
try
{
var Fields = document.getElementById("tab"+(TabIndex-1)).getElementsByTagName(TagName);
//Put this code onLoad of any event and this will disable all the fields on the CRM form
for(i=0;i
if(!Fields[i].ReadOnly)
{
Fields[i].ReadOnly=true;
}
if(!Fields[i].Disabled)
{
Fields[i].Disabled=true;
}
}
}
catch(e)
{
}
}
//Execute the main logic
function Execute()
{
//Disable tabs
DisableTabs();
//Disable fields incase user uses KEYBOARD TAB KEY
DisableFields("SPAN");
DisableFields("IMG");
DisableFields("INPUT");
DisableFields("TEXTAREA");
}
window.attachEvent("onresize",DisableTabs);
Execute();
/**********************************/
//END
/**********************************/

Nice article currently i am working in MS CRM 3.0, i am new to CRM
i need some basics about the CRM, is there any study materials to learn about MS CRM. please help me...