You need to sign in to do that
Don't have an account?

Compile Error: Constructor not defined: [selectoption].<Constructor>(String, String) at line 9
Hi,
<apex:page Controller="selectst" >
<apex:form >
<apex:selectList value="{!str}">
<apex:selectOptions value="{!values}" />
</apex:selectList>
</apex:form>
</apex:page>
Controller :--------------
public class selectst {
public List<SelectOption> getValues() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public string str {get;set;}
}
Can any one help me?
Hi,
Update your controller code :)
public class selectst {
public string str {get;set;}
public selectst ()
{
}
public List<SelectOption> getValues() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
}
No, it's not working
i also tryed with same constructor , but i couldn't resolve issue.
Let me know if there is any another way
Your code seems to be correct. Infact I copy pasted your code in my org and I didn't get any exception.
hi,
update bf page
<apex:selectList value="{!str}" multiselect="false" size="1">