public class SampleController {
Public List<string> countries {get;set;}
public SampleController(){
countries = new List<string>();
}
public List<SelectOption> getCountryList() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('USA','USA'));
options.add(new SelectOption('INDIA','India'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}
public pagereference getSelectedCountries(){
system.debug('selectedcountries -' + countries);
return null;
}
}
Output:
To display checkbox options in vertical direction, use layout property layout="pageDirection" in selectCheckboxe component.