I am facing an issue whereby I am unable to check from the values populated in a SelectItem.
DataSource ds = Datasource.get("users");
SelectItem selectItem = new SelectItem("Select One");
selectItem.setRequired(true);
selectItem.setAllowEmptyValue(false);
selectItem.setOptionDataSource(ds);
selectItem.setDisplayField("username");
myDynamicForm.setFields(selectItem);
The SelectItem is populated with the items in the datasource and displays the options correctly with the "username" field. But I am unable to select any option other than the first one. I am not sure if I am missing anything. Appreciate any help.
Oops. The setValueField method is to be called on the SelectItem. Once I set that, it works correctly.