The following code shows that if you select multiple values for a select item and validate, getValues returns an empty array. If you don't validate, it returns the correct values.
Code:
public void onModuleLoad() { IntegerItem hours = new IntegerItem(); hours.setTitle(UI.getLabelTitle("Total Hours")); hours.setWidth(50); final SelectItem select = new SelectItem(); select.setWidth(250); select.setTitle(UI.getLabelTitle("Competencies")); select.setMultiple(true); select.setMultipleAppearance(MultipleAppearance.PICKLIST); select.setAddUnknownValues(false); LinkedHashMap<String,String> map = new LinkedHashMap<String,String>(); map.put("v1","Option 1"); map.put("v2","Option 2"); map.put("v3","Option 3"); select.setValueMap(map); final DynamicForm form = new DynamicForm(); form.setItems(hours,select); IButton save = new IButton("save"); save.setTitle("Save"); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (form.validate()) SC.say("n="+select.getValues().length); } }); VStack stack = new VStack(); stack.addMember(form); stack.addMember(save); stack.draw(); }
Comment