0

I have a custom object say preferences__c which has a picklist called country__c with some values in it. The visualforce page is something like this.

<apex:page StandardController="preferences__c" docType="html-5.0">

The page has a HTML5 select tag. when the page loads I need to bind field values of picklist country__c to the select tag. I admit I am a novice to this, any help will be very much appreciated.

10
  • Please add VF Page code!
    – RSG
    Commented May 12, 2017 at 11:04
  • <apex:page StandardController="preferences__c" docType="html-5.0"><head>table> <select name="Country"> <option value="USA">USA</option> The value "USA" should come from field country__c.
    – user36821
    Commented May 12, 2017 at 11:04
  • If you are using standardController, you can use apex:inputField tag, rest rendering VF compiler will going to take care: <apex:inputField value="{!preferences__c.country__c}"/>
    – RSG
    Commented May 12, 2017 at 11:06
  • U mean just remove the HTML5 select tag and replace it with <apex:selectOptions> tag
    – user36821
    Commented May 12, 2017 at 11:15
  • 1
    @RSG Why remove the HTML5 tag? Using the Input Field helper would work just as well with it?
    – Dan Jones
    Commented May 12, 2017 at 13:45

1 Answer 1

0

remove HTML5 tag and you can use this:

<apex:inputField value="{!preferences__c.country__c}"/>

You must log in to answer this question.