I need implements the LostFocus Event in TextField

Hi everyone!

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 (“”).

When I can make this?


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.

The event fired when a field loses focus is the
So you can register a BlurListener object with the textfield

tf.addBlurListener(new BlurListener() {

            public void blur(BlurEvent event) {
               // your validation rules

thanks I test it!