You need to sign in to do that
Don't have an account?
Invalid selectOptions found. Use SelectOption type in Apex.
Im tring to display a picklist from my custom object.
Facing this error: Invalid selectOptions found. Use SelectOption type in Apex.
////////////VF////////////////////
<apex:selectList id="sta" value="{!SelectedState}">
<apex:selectOption value="{!StateList}" />
</apex:selectList>
////////////////////////Controller////////////////////////
public with sharing class salesofficer {
public list<SelectOption> StateList {
get{
list<SelectOption> st= new list<SelectOption>();
Schema.DescribeFieldResult fieldResult = UV_Dealer__c.City__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry f : ple)
{
st.add(new SelectOption(f.getLabel(), f.getValue()));
}
return st;
}
set; }
public String SelectedState { get; set; }
Please help me in this code or suggest me any other easist way to do the same thing
replace
<apex:selectOption value="{!StateList}" />
with
<apex:selectOptions value="{!StateList}" />
use selectOptions instead of selectOption.
dropdown list.
how to do it?
apex:selectList id="sta" value="{!SelectedState}" size="1" multiselect="false">