Tuesday, December 1, 2009

Function to show/hide CRM controls on a CRM form

// Function to show/hide CRM controls on a CRM form
// such as text boxes, lookups, pick-lists etc.
//this function takes two parameters, the crm attribute name and the visibility('none','block')
function setCrmControlVisible(elementName, visibility)
{
setElementVisible(elementName + '_c', visibility); //this for the caption means the label
setElementVisible(elementName + '_d', visibility); //this is for the actual control
}

// Fuction to show/hide specific elements on a CRM form
function setElementVisible(elementId, visibility)
{
var elem = document.getElementById(elementId); //getting the element
if (elem != null)
{
elem.style.display = visibility;
}
}

No comments:

Post a Comment