function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AdamSBealAdamSBeal 

VF Page embedded in Standard Page Layout Spacing

I have a custom field on accounts called "AccountAlerts" which may have a value in it but most times will not. I want to display that value prominently for customer service reps if it is there in the Contacts standard page layout at the top of the page. I created a visual force page to show the alert and I can hide it if it isn't there but the space is still taken up in the standard layout page when it is invisible since salesforce forces you to specify the height in pixels for the section. 

 

My question is there some way in Javascript or somehow to hide a section completely if it is not needed? I saw this sample on another thread but not sure how to get the id of a page layout section or even if it would work:

 

  document.getElementById('id').style.display = 'none';// Does not show the section.

 

Thanks! 

 

Adam

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

I think you'd need to put that into the sidebar as an HTML component - that's the only way to add JS to standard pages that I'm aware of.  

 

Jason Venable (aka TehNerd) produced an example of using the sidebar to hide buttons at:

 

http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/ 

 

I'd imagine this should be adaptable for what you are looking for.