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
Andy SchwartzAndy Schwartz 

Conditionally Display an iFrame in a Visualforce page.

I have a simple VF page with an iframe embed, which I display as a Visualforce element on a record layout. I was wondering if it was possible to conditionally display the iframe based on whether the value of a text field on the record is NULL or not.

If NULL then no iFrame (or even a different iframe or static content)
If Not NULL then display the iframe.
Best Answer chosen by Andy Schwartz
Michael VerhovskiMichael Verhovski
You could use rendered attribute. For example

<apex:iframe src="http://www.salesforce.com/" scrolling="true" id="theIframe" rendered="{!ISNULL(foo)}"/>


All Answers

Michael VerhovskiMichael Verhovski
You could use rendered attribute. For example

<apex:iframe src="http://www.salesforce.com/" scrolling="true" id="theIframe" rendered="{!ISNULL(foo)}"/>


This was selected as the best answer
Michael VerhovskiMichael Verhovski
Andy, Please mark my answer as a solution to your question if it solves your problem
Andy SchwartzAndy Schwartz
Sorry about that, Michael!