C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Disable CRM 3.0 TABS Completely


Posted Date: 20 Aug 2008    Resource Type: Articles    Category: Microsoft Dynamics
Author: AshwinikumarMember Level: Bronze    
Rating: Points: 7



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
/**********************************/







Responses

Author: senthil kumar    12 Sep 2008Member Level: Bronze   Points : 1
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...


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Ms crm  .  Diable CRM tab  .  Crm 3.0  .  3.0  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Javascript to get Logged in USER info for Microsoft CRM 3.0 and 4.0
Previous Resource: C#-The Language : A Step Ahead Series-Part-I
Return to Discussion Resource Index
Post New Resource
Category: Microsoft Dynamics


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use