-
8 Sep 2009 10:02 AM #1
[FIXED] A ComboBox's empty text is not shown when calling clearInvalid
[FIXED] A ComboBox's empty text is not shown when calling clearInvalid
- Windows XP
- Latest 2.0.x GXT from SVN
- GWT 1.7
Load the testcase and notice that the empty text for the ComboBox is not displayed. Giving the element focus and then clicking outside will show the empty text.
Code:public class Test extends LayoutContainer { public Test() { final Model testModel = new Model(); final FormPanel form = new FormPanel(); form.setHeading("Validation Demo"); form.setWidth(400); final TextField<String> firstName = new TextField<String>(); firstName.setFieldLabel("First Name"); firstName.setName("firstName"); firstName.setAllowBlank(false); firstName.setValidateOnBlur(false); firstName.setEmptyText("Enter a name"); final List<ComboModel> comboModel = new ArrayList<ComboModel>(); comboModel.add(new ComboModel("Donald")); comboModel.add(new ComboModel("Mickey")); comboModel.add(new ComboModel("Goofy")); final ListStore<ComboModel> modelStore = new ListStore<ComboModel>(); modelStore.add(comboModel); final ComboBox<ComboModel> combo = new ComboBox<ComboModel>(); combo.setName("comboModel"); combo.setDisplayField("name"); combo.setFieldLabel("Test"); combo.setStore(modelStore); combo.setForceSelection(true); combo.setAllowBlank(false); combo.setValidateOnBlur(false); combo.setEmptyText("Select something"); final FormBinding binding = new FormBinding(form); binding.addListener(Events.Bind, new Listener<BindingEvent>() { @Override public void handleEvent(final BindingEvent be) { for (final Field<?> field : form.getFields()) { field.clearInvalid(); } } }); final Button button = new Button("Unbind form", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(final ButtonEvent ce) { binding.unbind(); } }); form.add(firstName); form.add(combo); form.add(button); binding.bind(testModel); binding.autoBind(); add(form); } } class Model extends BaseModelData { public String getFirstName() { return (String) get("firstName"); } public void setFirstName(final String name) { set("firstName", name); } public ComboModel getComboModel() { return (ComboModel) get("comboModel"); } public void setComboModel(final ComboModel comboModel) { set("comboModel", comboModel); } } class ComboModel extends BaseModelData { public ComboModel(final String name) { setName(name); } public String getName() { return (String) get("name"); } public void setName(final String name) { set("name", name); } }
-
8 Sep 2009 10:31 AM #2
-
8 Sep 2009 10:46 AM #3
Work fine now, thanks.
You found a bug! We've classified it as
a bug in our system.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote