Stimpson Cat
Stimpson Cat

Reputation: 1508

Vaadin 14 disable text inline editing in a combobox component

I am using a combobox in a webapp with Vaadin 14. When the user clicks into the textfield, he can enter text. I do not want that. The values of the combobox itself should not be editable, but the user should still be able to select the predefined values. This is the standard behaviour of these components. How to do that in Vaadin 14.6.8?

Upvotes: 0

Views: 584

Answers (2)

Rolf
Rolf

Reputation: 2418

The standard behavior of a ComboBox is that you can both type and select – thus the "combo".

I believe you are looking for the Select component: https://vaadin.com/docs/v14/ds/components/select

Upvotes: 4

Stimpson Cat
Stimpson Cat

Reputation: 1508

The solution I found on the internet (on the feature request site):

cb.getElement().setAttribute("onkeydown", "return false");

It works partially, the cursor keeps blinking in the textfield, but custom user input is disabled.

Upvotes: 0

Related Questions