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
JAMBERT JESUDASANJAMBERT JESUDASAN 

Populate 2 Lead Picklist fields(with field dependency) in a visualforce page

Hi,

I have two custom picklists in a Lead Object(Location__c and Program__c) and Program__c will be displayed based on the Location__c(Field Dependency i have set). I have one registration VF page. In that page i need to populate the same logic.
 
can anyone help me to complete this logic?

Thanks!

DeveloperSudDeveloperSud
Hi Jambert,

This can be easily implemened if you created those fields in the lead object with the proper field dependencies.In your vfpage just called those fields.You can refer the below Vfpage as a sample.
<apex:page standardController="lead" >
<apex:form >
  <apex:inputField value="{!lead.Location__c}"/>&nbsp;
   <apex:inputField value="{!lead.Program__c}"/>
 </apex:form> 
</apex:page>
You can refer the below link for field dependencies and controlling-dependent picklists.
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_dependent_picklists.htm