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
Bablu Kumar PanditBablu Kumar Pandit 

How to add picklist filed and value in vf page

How to add picklist value in vf page 
Best Answer chosen by Bablu Kumar Pandit
David Zhu 🔥David Zhu 🔥
in VF Page:

        <apex:selectList value="{!myRating}" multiselect="false">
            <apex:selectOption itemValue="1" itemLabel="1"/>
            <apex:selectOption itemValue="2" itemLabel="2"/>
            <apex:selectOption itemValue="3" itemLabel="3"/>
            <apex:selectOption itemValue="4" itemLabel="4"/>
            <apex:selectOption itemValue="5" itemLabel="5"/>

        </apex:selectList>


in Apex controller:

 public string myRating {get;set;}
 

All Answers

David Zhu 🔥David Zhu 🔥
Would <apex:inputField> compnent work for you? This component handles all sorts of field data type.

<apex:inputField value="{!contact.Salutation}"/>
Bablu Kumar PanditBablu Kumar Pandit
i want to create a custom Picklist value Like 
Enter Rating -> has Value from 1 to 5
David Zhu 🔥David Zhu 🔥
in VF Page:

        <apex:selectList value="{!myRating}" multiselect="false">
            <apex:selectOption itemValue="1" itemLabel="1"/>
            <apex:selectOption itemValue="2" itemLabel="2"/>
            <apex:selectOption itemValue="3" itemLabel="3"/>
            <apex:selectOption itemValue="4" itemLabel="4"/>
            <apex:selectOption itemValue="5" itemLabel="5"/>

        </apex:selectList>


in Apex controller:

 public string myRating {get;set;}
 
This was selected as the best answer