Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
ComboBox does (sometimes) not keep new value when form is saved
The combobox gets the values from an ArrayList. The list is created from all categories that have been used previously.
The user should be able to enter a new category not already in the list.
Here is my code: (MPComboBox extends ComboBox
final MPComboBox categories = (MPComboBox) mapFields.get(FieldsWorkTime.CATEGORY.getFieldName());
categories.setImmediate(true);
categories.setInputPrompt("select category ...");
categories.addItems(dominoData.getViewColumnValue("vw.query.time.control", 0));
categories.setNewItemsAllowed(true);
categories.setTextInputAllowed(true);
categories.setNewItemHandler(new NewItemHandler() {
private static final long serialVersionUID = -3690522234181782921L;
@Override
public void addNewItem(String newItemCaption) {
categories.addItem(newItemCaption);
categories.setValue(newItemCaption);
}
});
The problem, I have is that the new value is not saved, when I click the "Save" button on my form. Same behaviour, when I click into one of the other input fields on the form.
Only if I type in the new value and hit TAB, the new value stays in the combo box and is then saved.
Is there anything, that I am missing?
Hi,
there is a relevant ticket: https://dev.vaadin.com/ticket/18366
And you can try to use this addon instead of the standard ComboBox: https://vaadin.com/directory#!addon/legacycombobox
Regards,
Sergey.