I have a custom component that extend of TextField. This component validates the value of textfield with a regular expression assigned by the method isValid(). Very useful for emails, positive numbers, telephone numbers etc.
The regular expression was previously assigned to the component for use the isValid().
I need the textfield to lose focus, run the method isvalid. If the validation is false, the value of textfield is reassigned to empty String (“”).
The ValueChangeListener on a Textfield is called when you press Enter and when the textfield looses focus. So you might be able to use this Listener if you don’t mind about the code being also activated by pressing Enter.