CRM 2011 – Hiding a Form’s Header and Footer

While Microsoft provides a button to minimize a form’s header, we had to fulfill a requirement to automatically minimize the header and completely hide the footer for several entities. The reasoning behind this was that most users weren’t going to be making changes to these records, so the client wanted to provide the maximum amount of viewable space. For instance, the Account form normally displays like this, but we wanted to reclaim at least that 90px of height from the ribbon:

Account Form

As it turned out, all it took was a couple simple JavaScript functions called in the form’s OnLoad event to make this happen. When looking into how to hide the ribbon, I came across this article, which lists code to hide different elements on the form and contained discussion regarding the ribbon’s minimize functionality and how to leverage it during the form’s OnLoad event. Hiding the ribbon was just a matter of firing the “onclick” event for the “minimizeribbon” button after it had rendered:

function Hide_Ribbon() 
  setTimeout(function () {"minimizeribbon").fireEvent("onclick"); }, 0);

And hiding the footer was even easier, since you could just set a “display: none;” for the footer’s parent:

function Hide_Footer()
  document.getElementById("crmFormFooter") = "none";

The result looks something like this:

Account Form - No Header or Footer

The biggest downside to this approach, though, is that the header and footer will momentarily display before the JavaScript kicks in and hides them. Still, if your users don’t need to use the ribbon on a regular basis and are starved for screen space, this is a quick and easy way to give them a little more room.

Tags: , , , ,

Leave a Reply