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

Dependent Picklist to be shown in visualforce page

Hi all,


I have a requirement where there are two picklist (Region and City Names) in the same object. Upon selecting Region, its respective Cities must be seen in the City Names picklist and I have made these two as dependent picklist. Here, I am using a VF page and I am not able to achieve dependent picklist. 


So, I need a help in here to get my issue solved.


Best Regards




Try this code:-


<apex:page standardController="Account">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >              
                <apex:inputField value="{!Account.Region__c}"/>
                <apex:inputField value="{!Account.Cities__c}"/>

Ankit AroraAnkit Arora

if you have the picklist dependent on object then you only need to show them up on visualforce page using inputfield, and it will work.



Ankit Arora

Blog | Facebook | Blog Page


Hi Anil and Ankit,


In the object, I have defined these two picklists (Region__c & Cityt__c) as dependent ones. 

I did try this already and here is what I had written:

<apex:pageBlockSectionItem >
    <apex:outputLabel value="Regions" style="position:relative;left:-100px"/>
    <apex:inputField value="{!LeadInfo.Region__c}"/>

<apex:pageBlockSectionItem >
    <apex:outputLabel value="City" style="position:relative;left:-60px"/>
    <apex:inputField value="{!LeadInfo.City__c}"/>


public Lead__c LeadInfo = new Lead__c();
public Lead__c getLeadInfo()
return LeadInfo;