get TextInput value back in ComboBox

Hi,

I have a ComboBox with setTextInputAllowed to true, but How do I get the textinput value back? I tried call getValue(), but the return is null? then how do I get the user input back?

Thanks in advance.

Hi!
setTextInputAllowed is true by default. Try setNewItemsAllowed(true) too, that will allow adding items to your select on both blur and when enter is pressed. Does this help you?

No luck. get get null from getValue(). but thanks for answer anyway.

How have you created your ComboBox? At what point are you checking for the value?

Hello,

This worked for me. Add a few items to the ComboBox, and click the “Click” button. A notification should popup displaying the chosen value.

CssLayout layout = new CssLayout();
layout.setSizeFull();
setContent(layout);

final ComboBox combobox = new ComboBox();
combobox.setNewItemsAllowed(true);

Button button = new Button("Click", new Button.ClickListener() {

  @Override
  public void buttonClick(ClickEvent event) {
    Notification.show(combobox.getValue().toString());
  }
});

layout.addComponents(combobox, button);

All right. It works now. The problem is the IDE somehow didn’t auto deploy the changed code after rebuild.

Thanks for your guy.