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
akshay desai 9akshay desai 9 

How to show only particular value of picklist in visualforce

I am using Schema.PicklistEntry but i dont want to show every value of picklist on a vf page 
VinayVinay (Salesforce Developers) 
Hi Akshay,

You can use 'apex:selectOption' to display only selected values on VF page.

Please find below sample example:

<apex:page controller="chooseColor">
        <apex:selectList id="chooseColor" value="{!string}" size="1">
            <apex:selectOption itemValue="red" itemLabel="Red"/>
            <apex:selectOption itemValue="white" itemLabel="White"/>
            <apex:selectOption itemValue="blue" itemLabel="Blue"/>
 /*** Controller ***/
public class chooseColor {
    String s = 'blue';
    public String getString() {
        return s;
    public void setString(String s) {
        this.s = s;

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. 

Vinay Kumar