Posts

Showing posts from March, 2018

Show/Hide a particular section of VF Page

This post is part of the previous post. you can check here--- How to show or hide a particular section of Visualforce Page dependent upon picklistfield value   Here I am using the custom controller to achieve this functionality. Controller-- public class ShowMyContacts  {         public string source {get;set;}     public List<selectOption> sourceValue {get;set;}     public boolean flag {get;set;}     public boolean flag1 {get;set;}     public boolean flag2 {get;set;}     public Contact contact {get;set;}               public ShowMyContacts()     {         flag = false;         flag1 = false;         flag2 = false;         sourceValue = new List<selectOption>();         sourceValue.add(new selectOption('','--select--'));         sourceValue.add(new selectOption('web','Web'));         sourceValue.add(new selectOption('phoneinquiry','Phone Inquiry'));         sourceValue.add(n

How to show or hide a particular section of Visualforce Page dependent upon picklistfield value

Image
In this example, I am going to explain that how to show/hide a particular section of Vf Page that depends on a picklist field value i.e. for a specific picklist value you are showing/hiding a particular part of a VF Page. This can be achieved by using both the Standard Controller and as well as Custom controller functionality. Here I am using Standard Controller functionality. VF Page--- < <apex:page standardController="Contact">   <apex:form id="frm">       <apex:pageBlock >           <apex:pageBlockSection >               <apex:inputField value="{!contact.LeadSource}">                   <apex:actionSupport event="onchange" reRender="frm"/>               </apex:inputField>            </apex:pageBlockSection>            </apex:pageBlock>              <apex:pageBlock rendered="{!IF(contact.LeadSource == 'Web', true , false)}">