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
jaw999jaw999 

Visualforce dependent picklists not respecting controlling fields

I have two picklists. One controls the other.
In my visualforce edit page, the dependent field always shows all options no matter what is selected in the controlling field.
I am confused if this is something I need to code for.
Some links seem indicate that regular apex:inputfield should handle the restrictions.
Examples:
http://salesforce.stackexchange.com/questions/5439/how-can-we-write-dependent-picklist-through-apex-code/
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_dependent_picklists.htm

Am I misunderstanding this?

My simple test page always shows all choices available in the dependent field.

    
<apex:page standardController="Opportunity">
        <apex:form >
            <apex:pageBlock mode="edit">
                <apex:pageBlockButtons >
                    <apex:commandButton action="{!save}" value="Save"/>
                </apex:pageBlockButtons>
                <apex:pageBlockSection title="Dependent Picklists" columns="2">
                <apex:inputField value="{!Opportunity.Global_Entity_Type__c}"/>
                <apex:inputField value="{!Opportunity.SubType__c}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>
        </apex:form>
    </apex:page>
Best Answer chosen by jaw999
jaw999jaw999
It was version setting issue. My page was genereated via Etherios EasyPage and it created it in version 15.0! Upgrading to version 30 resolved the issue.

All Answers

ArmouryArmoury
The link VF-Dev Guide (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_dependent_picklists.htm) says..
  • If the user viewing the page has read-only access to the controlling field, a dependent picklist might not behave as expected. In this case, the dependent picklist shows all possible values for the picklist, instead of being filtered on the read-only value. This is a known limitation in Visualforce.

Can you check this point is valid in your case.
jaw999jaw999
It was version setting issue. My page was genereated via Etherios EasyPage and it created it in version 15.0! Upgrading to version 30 resolved the issue.
This was selected as the best answer