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
MissaTXREGNMissaTXREGN 

Render based on value in multi select picklist

I need to render a field based on values in a multi select picklist.  Basically if it contains Special Project, then render the special project field.  However, I can't use includes in the render formula or so says the error message.  Here is what I'm using.  Is there another way to do this?

 

 <apex:pageBlockSectionItem rendered="{!Includes(InteractionRequest.Interaction_Type__c, 'Special Project')  }">
                           
<apex:outputLabel value="Special Projects" for="{!InteractionRequest.Special_Projects__c}"/> 
     <apex:inputField value="{!InteractionRequest.Special_Projects__c}" required="false" />

</apex:pageBlockSectionItem>  

 

Navatar_DbSupNavatar_DbSup

Hi,

 

You can use the CONTAINS instead of Includes for rendered the page block selection item

 

For Reference use below code snippet

 

--- VF page--

<<apex:page controller="cls_rernederpageblock" >

 <apex:pageBlock >
 <apex:pageBlockSection >
 <apex:pageBlockSectionItem rendered="{!CONTAINS(cc.number__c,'1')}" >
 
   hi....
 
 </apex:pageBlockSectionItem>
 
 
 </apex:pageBlockSection>
 
 
 </apex:pageBlock>

</apex:page>


--- Apex Controller ----

public class cls_rernederpageblock 
{
    public contact cc{get;set;}
   
    public cls_rernederpageblock()
    {
 
        cc=[select number__c from contact where lastname='abc'];
      
    }

}

 

number__c is a multi select picklist and contain the 1,2,3,4 as values.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 


RichardR1RichardR1
Actually if you use CONTAINS, you would need to use it inside of IF(). Example: IF(CONTAINS(Field, 'text'), true, false)