Thursday, September 11, 2008

CRM 4.0 Tab How To Tips

It occurred to me that most of the samples in my blog are more of a “complete solution” or too complicated. Sometimes you’re only looking for a line or two to integrate with your own code.In order to address that issue I have decided to write a series of How-To posts which are simple and usually address a specific requirement.

The how-to posts are categorized by common client side development tasks like CRM Form, CRM Fields, CRM IFRAME, CRM Lookup and so on. Each time something new comes up I’ll simply update the relevant “Repository” How-To post. If you have a specific requirement that you don’t see in my post and you feel that should be then comment on that and if it is missing I’ll share that solution when I can.


This How-To post addresses CRM Tab development tasks:

Select a specific Tab (First Tab index is 0)


var tabIndex = 2; //Third Tab
var tab = document.getElementById("tab" + tabIndex + "Tab");
if( tab ) tab.click();



Hide Specific Tab (First Tab index is 0)



var tabIndex = 1; //Second Tab
var tab = document.getElementById("tab" + tabIndex + "Tab");
if( tab ) tab.style.display = 'none'; //'inline'

2 comments:

Sanjay Munjal said...

Hi,
Your JScript code for Selecting a specific Tab does not work as mentioned if it have only a IFRAME showing external site. I am switch to this tab and setting dynamically the src of the IFRAME. TAB does not become active after onload. Do you think one should wait for readystate as form is still loading.
Otherwise great tips and blog.
Regards.
Sanjay Munjal

Adi Katz said...

Hi,

I can’t figure out which part of my code is not working for you.

Can you see the tab with the external site IFRAME?

Can you see the IFRAME content?
If not, to make it simple, you can always bind to the tab onclick event and then set the iframe source.