Monday, December 28, 2009

How to hide Section in Dynamics CRM 4.0 Form ?

//Sample Code

if (crmForm.all.province_supportdeduction.DataValue==1)
{
//HideSection(tabindex,sectionindex,none/block);
HideSection( 0 , 2 , "none" );
HideSection( 0 , 3 , "none" );
HideSection( 0 , 4 , "block" );
}
else
{
HideSection( 0 , 2 , "block" );
HideSection( 0 , 3 , "block" );
HideSection( 0 , 4 , "none" );
}

// Function to Hide Section in the form
function HideSection( tabIndex , sectionIndex , displayType )

{
var tab2Hide = document.getElementById( "tab" + tabIndex );

tab2Hide.childNodes[0].rows[ sectionIndex ].style.display = displayType;

}