Please reload

Recent Posts
Featured Posts

Show fields based on what the user selects on a multi-select picklist.

April 27, 2015

I know if you're familiar with Visualforce the first thing that comes in your mind is to use the 'CONTAINS' function, which is true, but you need more. You need to use 2 arguments joined by an 'OR' to control the behaviour to ensure that the field is not rendered when the page loads.



Click Option 2 Here  for the Demo: and select Yellow and Blue.





<apex:page standardController="Client__c" showHeader="false" sidebar="false">

<apex:form >


<apex:pageblock >

<apex:pageBlockSection title="Pick your favourite colors" columns="1"> 

<apex:outputPanel id="p1">


        <apex:inputField value="{!Client__c.Fav_colors__c}"><apex:actionSupport event="onchange"  rerender="p1"/></apex:inputField>


        <apex:inputField value="{!Client__c.Reason_You_Love_Yellow__c}" html-placeholder="Reason you love Yellow" rendered="{!(Contains(Client__c.X3_fav_colors__c, 'Yellow'))||(ISBLANK('Yellow'))}" /> <p></p>


        <apex:inputField value="{!Client__c.Reason_You_Love_Blue__c}" html-placeholder="Reason you love Blue"  rendered="{!(Contains(Client__c.X3_fav_colors__c, 'Blue'))||(ISBLANK('Blue'))}" />










On the code above, fields Reason_You_Love_Yellow__c and Reason_You_Love_Blue__c are only showed if the user selects them. If the user de-selects them, they disappear. 

Please reload

Follow Me
Please reload

Search By Tags
Please reload

  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

Data Visualization with Chart.JS in Lightning Components

October 3, 2019

Please reload


  • White LinkedIn Icon
  • Twitter Clean
  • Salesforce Whizz

© 2020 by Mhlangano Khumalo 

All rights reserved