woensdag 20 augustus 2008

Hidden buttons reappear when resizing a crmForm

In a previous post I described how to hide custom buttons in a toolbar.
When a CRM form is resized by the user it appear that these hidden buttons will show up again.

To avoid this behaviour you should put your code into a global function and attach this function to the resize event of the window.

Example:

This code should be placed in the onload of the form.

HideButton = function()
{
var ULListItems = document.getElementById("mnuBar1").rows[0].cells[0].getElementsByTagName("UL")[0].getElementsByTagName("LI");
for(var i=0; i -1)
{
ULListItems[i].style.display = "none";
}
}
}

// Execute the function when loading the form
HideButton();

// Execute the function when the form is resized.
window.onresize = HideButton;

Geen opmerkingen: