Focus automaticaly jump to the next field when enter presset or field maxLe

I would like to jump automaticaly to the next text/Date field when reaching the maxLenght size or key enter pressed.

I’m new to vaddin and I don’t figure out how to implement that behaviour.

regards.

For jumping into the next field when max length is reached the answer depends on which version of Vaadin you are using. For Vaadin 7:
you can use a
TextChangeListener
and in the listener implementation check the text length from the event parameter and call .focus() of the next field.
Vaadin 8: you just set the
ValueChangeMode to EAGER
, check the value length in a ValueChangeListener and call .focus() of the next field.

For how to find the next field you can e.g. iterate over the Components in your layout and check if the next component is of type
Focusable

For handling a enter key press I’d recommend using the
keyactions
add-on as the Vaadin built-in key event handling is a bit clumsy.