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
SFDC-NOOBSFDC-NOOB 

Conditionally Display an Image

Greetings,

 

I am attempting to display an image on a visualforce page if account.dq_reason__c == 'Out of Business'

 

The image displays but the problem is it ALWAYS displays.  I only need it to display when the dq_reason is "Out of Business".  Seems like a simple task but I don't know what I am doing wrong.  Any help is greatly appreciated.  Thanks in advance.

 

****************************************************VisualForce Page*************************************************************

 

<apex:page standardController="Account" showHeader="true"  >

<img src="{!$Resource.Black_Box}" width="600" height="60" rendered ="{!account.DQ_Reason__c =='Out of Business'}" />


<apex:detail relatedList="false" title="true"/>


<apex:relatedList subject="{!account}" list="contacts" />


<apex:relatedList subject="{!account}"
list="opportunities" />


<apex:relatedList subject="{!account}"
list="OpenActivities" />


<apex:relatedList subject="{!account}"
list="NotesAndAttachments" />


</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
ryanjuptonryanjupton

Hi Josh,

 

There are a number of threads on the discussion boards that discuss how to conditionally render content. You might be better off and faster searching the existing threads.

All Answers

ryanjuptonryanjupton

Hi Josh,

 

There are a number of threads on the discussion boards that discuss how to conditionally render content. You might be better off and faster searching the existing threads.

This was selected as the best answer
SFDC-NOOBSFDC-NOOB

Ryan,

 

Thank you for your reply.  The solution was as simple as including an Apex tag!   The correct code is as follows:

 

<apex:image id="Black_Box" value="{!$Resource.Black_Box}" width="600" height="60"  rendered="{!account.DQ_Reason__c =='Out of Business'}"/>

 

Thanks again, Ryan.