+ Start a Discussion
Santosh KumbarSantosh Kumbar 

Dynamically controll the height of VF page Used in Case page layout???

Hi all

  i used VF page in case layout which displays the long text from other object. now text when i included it in case layout it should vary according to the text size... please help me some one...




I think you would have a section for showing VF page in case layout. Edit this layout and got to that section edit the vf page setting and select the option for scroll bar and set the height & width for page and save the layout. Now section size is fixed and if you have more text , it display with scroll bar.


Second option is to create a floating div. Find below a sample code to make floating div to control the height :


<div style="text-align:left; vertical-align:top; width:90%; position:absolute; filter:alpha(opacity=100, style=0); -moz-opacity:50%; z-index:100;">


This topic has come up before.   When you include a VF page in a page layout you have to specify a size for the iframe.


Sadly, if the VF page is dynamic in nature, then sometime you have more or less than the space you've alloted.  And so, you want to dynamically change it so it looks right and doesn't have scroll bars.


The obvious approach is to use Javascript in the VF page to "back out" to the enclosing iframe and set the size once you know how big the vf page is.   


Sadly, VF pages and the Salesforce UI pages are hosted on different domains and any attempt to violate that will yield a cross site scripting violation.


So, sadly, the answer is still "No, you can't do that".  



You could, of course, build the enclosing Case layout page yourself in VF, and then you can either just embed the other vf with an Iframe, or a custom component, etc.    Either way, if you do that then yes, you could do it, but the downside is that you have to maintain your own Case Layout vf page.


Best, Steve.