You need to sign in to do that
Don't have an account?
Retrieving checked items
public class sampleCon {
String[] countries = new String[]{};
public PageReference test() {
return null;
}
public List<SelectOption> getItems() {
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[] getCountries() {
return countries;
}
public void setCountries(String[] countries) {
this.countries = countries;
}
}
Using the examples, I have no problem displaying on the page the values of the items checked.
However, I am trying to extract the values via code in the controller from the selectoptions that have been checked. I think this is possible in the getCountries() method, but I can't seem to figure out how to do it. Is it possible for someone to help me with the couple of lines of code necessary to make this happen?
Thanks for your help.
T
I am working with the sample code in the Apex manual dealing with the selectoptions class on pages 187-189 in the Apex reference