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.
  1. #1
    Sencha Premium Member
    Join Date
    Dec 2008
    Location
    Munich, Germany
    Posts
    183
    Vote Rating
    0
    Jose Jeria is an unknown quantity at this point

      0  

    Default [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);
        }
    }

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Fixed in SVN

  3. #3
    Sencha Premium Member
    Join Date
    Dec 2008
    Location
    Munich, Germany
    Posts
    183
    Vote Rating
    0
    Jose Jeria is an unknown quantity at this point

      0  

    Default


    Work fine now, thanks.

Thread Participants: 1