Tuesday, August 10, 2010

Hide Add Existing Record Button

HideAddExistingRecordButton('account_contacts', 'Add existing Contact to this record');

function HideAddExistingRecordButton(loadAreaId, buttonTitle)
{
var navElement = document.getElementById('nav_' + loadAreaId);
if (navElement != null)
{
navElement.onclick = function LoadAreaOverride()
{
// Call the original method to launch the navigation link
loadArea(loadAreaId);

var associatedViewIFrame = document.getElementById(loadAreaId + 'Frame');
if (associatedViewIFrame != null)
{
associatedViewIFrame.onreadystatechange = function HideTitledButton()
{
if (associatedViewIFrame.readyState == 'complete')
{
var iFrame = frames[window.event.srcElement.id];
var liElements = iFrame.document.getElementsByTagName('li');
for (var i = 0; i < liElements.length; i++)
{
if (liElements[i].getAttribute('title') == buttonTitle)
{
liElements[i].style.display = 'none';
break;
}
}
}
}
}
}
}
}

No comments:

Post a Comment