Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
TextChangeEvent & Validation
From a usability point of view I want to disable/enable a submit button of a form instantly when a user fills out the form.
It would really make no sense to let the user first click on the button and to tell him afterwards that there is something wrong.
Additionally I want the validation errors to be instantly visible while typing for the same reason.
Using the ValueChangeEvent won't work, as the user has to change the focus for the input field first before the listener gets triggered. This applies to the enable/disable of the submit button (user has to at least change focus for the last input field) as well as for the instant validation.
Unfortunately using the TextChangeListener the method isValid() wont work, as internally the value was not set.
In the best case I want to use the built in bean-validation mechanisms and a BeanFieldGroup, so how to handle this situation?
You could just iterate over the validators and call validate() for the text in the TextChangeListener.
Ok, thank you for your suggestions :)