Reputation: 241
Suppose I have combo-box with allowed input. I want to limit input, for example user can enter only 10 characters . How can I do it? Thanks.
Upvotes: 3
Views: 1163
Reputation: 17075
This feature is not supported for ComboBox, in the same way it is available for all childrean of AbstractTextField
AbstractTextField.setMaxLength(int)
However this issue is recognized as a shortcoming of Vaadin ComboBox and there is already a Ticket created in Vaadin Trac issue management system:
when combobox.setNewItemsAllowed(true), there is not any method to set a maxlength to the input (like TextField.setMaxLength(int)). Suggested Method: combobox.setMaxLength(int maxLength);
If your company has a vaadin support subscription, you can even vote for the issue to get implemented.
Since the combobox does not support this functionality out of the box, you will need to implement it yourself, if you need it. Good way is to use Vaadin Extensions to extend existing ComboBox component with functionality required. Here are some resources to start with extensions:
Upvotes: 5