0

In my Visualforce, I want to show a traffic red light or green light base on some condition. Below you find my code:

<apex:outputpanel rendered="{!IF(OR(oldCrashesList.OCTO_Closure_Reason_Text__c == 'Customer contacted by phone: false alarm',oldCrashesList.OCTO_Validated_By_OTP__c == 'Not Validated'),true,false )}">
<apex:image value="{!$Resource.redligth}" />
</apex:outputpanel >
<apex:outputpanel rendered="{!IF(oldCrashesList.OCTO_Closure_Reason_Text__c !='Customer contacted by phone: false alarm',true,false)}" >
<apex:image value="{!$Resource.greenlight}" />    
</apex:outputpanel>

The problem is that both images are shown in my VF page and I don't understand why.The rendered conditions are opposite of each other.

  • 2
    The first one includes an OR so they are not exact opposites. – Keith C Jan 10 '17 at 9:38
  • Right, thank you Keith. I need the OR operator in the first output panel so I think that I have to use the same contions but negative, in the second output panel to obtain the exact opposite.Is it right in your opinion Keith? – L.benedettini Jan 10 '17 at 10:15
  • Probably clearest to just wrap the first IF(OR(...)) in a NOT for the second case i.e. NOT(IF(OR(...))). – Keith C Jan 10 '17 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.