// Gender Select - populated through a DataProvider
genderSelect = new Select("gender");
genderSelect.setRequired(true);
genderSelect.setDefaultOption(new Option("U", ""));
genderSelect.setDataProvider(new DataProvider() {
public List getData() {
List optionList = new ArrayList(3);
optionList.add(new Option("M", "Male"));
optionList.add(new Option("F", "Female"));
return optionList;
}
});
form.add(genderSelect);
// Investment Select - populated through Select.add methods
List investmentOptions = new ArrayList();
OptionGroup property = new OptionGroup("property");
property.add(new Option("Commercial Property", "Commercial"));
property.add(new Option("Residential Property", "Residential"));
investmentOptions.add(property);
OptionGroup securities = new OptionGroup("securities");
securities.add(new Option("Bonds"));
securities.add(new Option("Options"));
securities.add(new Option("Stocks"));
investmentOptions.add(securities);
investmentSelect = new Select("investment");
investmentSelect.setOptionList(investmentOptions);
investmentSelect.setMultiple(true);