You need to sign in to do that
Don't have an account?
akshay desai 9
I am using Schema.PicklistEntry but i dont want to show every value of picklist on a vf page
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
You can use 'apex:selectOption' to display only selected values on VF page.
Please find below sample example:
<apex:page controller="chooseColor">
<apex:form>
<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"/>
</apex:selectList>
</apex:form>
</apex:page>
/*** 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.
Thanks,
Vinay Kumar