3

Question

Can a Visualforce Page be built so it displays the actual picklist values and dependencies for fields which incorporate State and Country Picklists? I tried using Field Sets as well as hard-coded field references, and either way it just displays a text input.

MVR Markup

<apex:page standardController="Account">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection>
                <apex:inputField value="{!Account.BillingStreet}" />
                <apex:inputField value="{!Account.BillingCity}" />
                <apex:inputField value="{!Account.BillingState}" />
                <apex:inputField value="{!Account.BillingPostalCode}" />
                <apex:inputField value="{!Account.BillingCountry}" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Screenshot

BillingAddress inputFields

The edit page displays the picklist as expected:

BillingAddress detail

4
  • Bold formatting seems to have disappeared...
    – Adrian Larson
    Commented Nov 15, 2017 at 19:50
  • 2
    Try using the corresponding code field e.g. {!Account.BillingStateCode} - I think that presents the picklist values.
    – Keith C
    Commented Nov 15, 2017 at 20:51
  • @Keith The field labels on the edit page hint as much. Good idea, and it worked. Post as an answer and I will accept.
    – Adrian Larson
    Commented Nov 15, 2017 at 20:54
  • Done. Couldn't find any mention of that in the docs though.
    – Keith C
    Commented Nov 16, 2017 at 8:45

1 Answer 1

3

Using the corresponding code field in the Visualforce e.g. {!Account.BillingStateCode} instead of {!Account.BillingState}will present the picklist values.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .