0

We've got a custom object called Cost__c. We've got a custom VFP for this. I want to add a dependencies between two fields, Product_Type__c and Total_Number_of_Pages__c. Both fields are on the VFP (see below from VFP). Despite them both being on the VFP, I'm still getting the error "The dependent picklist 'Total Number of Pages' requires its controlling field 'Product Type' to be present on the page". I've checked the permissions on both fields and everything seems to be fine there. I thought that maybe it was because it was in an apex:ActionRegion but I tried removing that with no luck.

<apex:outputLabel value="Product Type" for="product"/>
     <apex:actionRegion >
       <apex:selectRadio value="{!Cost__c.Product_Type__c}" layout="pageDirection" id="product">
           <apex:selectOptions value="{!productTypeOptions}"/>
           <apex:actionSupport event="onchange" rerender="insideInkPanel,issuesPanel" status="refresh"/>
       </apex:selectRadio>
     </apex:actionRegion>

. . . .

<apex:inputField value="{!Cost__c.Total_Number_of_Pages__c}" id="pages">
   <apex:actionSupport event="onchange" rerender="method" status="refresh"/>
</apex:inputField>
  • 1
    Pretty sure you need both bound on an <apex:inputField>. – Adrian Larson Jan 30 at 22:43
1

This worked for me

    <apex:inputField value="{!Cost__c.Product_Type__c}"/>
    <apex:inputField value="{!Cost__c.Total_Number_of_Pages__c}"/>

Refer - https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_dependent_picklists.htm

  • Please add more details to answer, like why it will work? – rahul gawale Jan 31 at 2:40
  • 1
    apex:inputfield will carry all the properties associated with the field in our case the controlling and dependent field and this is not the case if you use it with selectRadio. – Sandeep Bollampally Jan 31 at 3:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.