Conditionally render fields on Visualforce page based on picklist values
An example of how to render a Visualforce page based on criteria.
<apex:pageBlock id="xxxpb1">
<apex:pageBlockSection>
<apex:actionRegion >
<apex:inputField id="xxxif1" value="{!Object.picklistfieldapiname1}" required="true" >
<apex:actionSupport event="onchange" rerender="xxxpb1" />
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSection>
<apex:pageBlockSection id="xxxpbs1" rendered="true">
<apex:inputField id="xxxif2" value="{!Object.Fieldtobedisplayed1}" rendered="{!IF(Object.picklistfieldapiname1 ='picklist value 1' || lead.Buyer_Type__c ='picklist value 2' ,true,false)}"/>
</apex:pageBlockSection>
<apex:pageBlockSection id="xxxpbs2" rendered="true">
<apex:inputField id="xxxif3" value="{!Object.Fieldtobedisplayed2}" rendered="{!IF(Object.picklistfieldapiname1 ='picklist value 3' || lead.Buyer_Type__c ='picklist value 4' ,true,false)}"/>
</apex:pageBlockSection>
</apex:PageBlock>
Please note that this is a sample code and should be customized according to a business requirement.
Comments
Post a Comment