0

I am trying to use IF Else condition in VF Page. It is working for IF block but I am not sure how to use else block.

Scenario is IF(Field="Hard Hat"), Show check box image; else show unchecked box image. It is working for checked scenario but when Hard Hat is not selected it is giving me 5 or 6 images of unchecked boxes.

Below is my code..

<div class="formdiv">
                          <apex:repeat value = "{!ehsdetails}" var = "ehsdetail">
                          <apex:outputPanel rendered="{!IF(ehsdetail.EHSD_PPE__c='Hard Hat', true, false)}">
                           <div class="inputdiv"><img src="/img/checkbox_checked.gif" class="frminput"/>Hard Hat</div>
                          </apex:outputPanel>
                          <apex:outputPanel rendered="{!IF(ehsdetail.EHSD_PPE__c!='Hard Hat', true, false)}">
                           <div class="inputdiv"><img src="/img/checkbox_unchecked.gif" class="frminput"/>Hard Hat</div>
                          </apex:outputPanel>
                          
                          </apex:repeat>

enter image description here

Please help on this.

2
  • Can you try <> for not equals. We dont have if else blocks in vf page . We have to render using IF() only Oct 11, 2022 at 7:21
  • @SaiPraveenKakkirala. I have tried <>. But result is same. I am getting multiple unchecked boxes for Hard Hat. Oct 11, 2022 at 7:35

0

You must log in to answer this question.