+ Start a Discussion
Rabbani sayyed 8Rabbani sayyed 8 

How will we implement the controlling and dependent pick list functionality using VF?

How will we implement the controlling and dependent pick list functionality using VF?
Chamil MadusankaChamil Madusanka
If you are using a two picklist fields which has already specified as controlling and depended picklist values, then you have to use just those fields in apex:inputField.
 
<apex:inputField value="{!Course__c.Option1__c}"/>
<apex:inputField value="{!Course__c.Option2__c}"/>


If you get the answer, please mark it as the correct answer. It will be a help to others who are facing the same problem later.
 
James LoghryJames Loghry
In Chamil's example, if I remember correctly, your visualforce page has to use a standard controller (E.g. Course__c for a course custom object or Contact for the Contact standard object).  It's a great solution if you're using dependent fields.

If you're looking to implement something more custom, that doesn't involve dependent fields, then take a look at this blog post on developer.salesforce.com: https://developer.salesforce.com/blogs/developer-relations/2011/01/fun-in-visualforce-with-dependent-select-lists.html.  You could simplify Pat's example there to be more dynamic in nature (instead of hard coding the select options in the controller for instance), but it should get you on the right track.