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
Kunlun liKunlun li 

How to control the dependency picklist field in visual force page?

Hi All

 

I create a picklist field A withdependency to field B. A should only display 2 values in picklist when B is some value.

 

Then I write a visual force page as <apex:inputField value="X.A"/>, but field A can not follow the dependency rule, but display all values in picklist, no matter the value of field B.

 

Anyone can help me?

 

Thanks

Kunlun

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

Check dependency and Controlling Fields of the pick lists.

 

Use the below code as a reference

 

<apex:page standardController="contact" >
 <apex:form >

<apex:inputField value="{!contact.industry_type__c}"/>
<apex:inputField value="{!contact.industry__c}"/>
 </apex:form>


</apex:page>

 

 Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.