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 in visualforce pages

I've 2 picklists, A & B, B picklist has A set as Controlling fields, now these two fields are not behing as dependent fields in my VF page :(. I wasn to display B values based on the selection on A picklist.


The dependent Picklists have been Set appropriately in Object. But when I use them in VF page the values just do not change, bit the picklists show All values stored in the field, irrespective of the selected value in the controlling field.


Can anyone help me here .. plz .... :(

Unfortunately, dependent picklists are not supported in VF pages.  You will need to use a custom controller or extension and programatically make the dependencies.
Ok, you mean to hard code values in the dropdown using custom extensions methods ?

I haven't tryed to do it yet, but my plan is that I would create a map of the dependent values to their related list, then every time something is selected in the controlling list,  I would update the dependent list with the new subset.  Not elegant, or easy to maintain, but all I can think of to address this need.

Maybe you  could post your code if you get something working?


My issue with coding is that, i am not able to read the Controlling field's value, I mean,


List A         List B

Val 1           B Val 1

                  B Val 2

Val 2           B Val 3

                  B Val 4

                  B Val 5


No in above example, my issue is I can read values in both the picklists, but HOW CAN i get the List B's values on the basis of selection in List A's value? I could not achieve that, so I'm stuck :(


Just did a quick google search and found this article,

Might help us both:




Yes already tried that, but if you havn't noticed then on PAGE 2 of this article its code uses 2 DIFFERENT objects to populate the 2 different Dropdown, so its simply a population of values using a QUERY which ran on 2 objects having picklist fields, but not on ONE object with 2 picklist fields with Controlling field set for one of them :(

My suggestion was to adapt that concepts in that article to your needs.
yes exactly, I have tried to use his concept .... I tried workign on it applying actionRegion tags, and tried refreshing the picklists, but the Dependent Picklist DIDn't populated with Selected Controlling field's value ...

I'm facing this issue now as well...


Have you tried going down the metadata API route yet?



yup .. already tried API coding tricks ... but no luck .. :(