Cancel all following events that are in the event queue

I was wondering if it was possible to clear the event queue or stop the events after a certain point in the queue from firing. Here is an example of what I was doing:
I have a screen with two controls on it, one is a custom text field that is an extension of the standard text field and the other is a button. When the text field loses focus (blur event) the even handler defined in the custom text field validates the value. If the valus is not valid, it then puts the focus back in the field and marks it in error.

When I click on the button the blur event fires and the validation check is performed. Then the button event will fire. What I want to do is if the text field is invalid, stop the button event from firing. I know I can use a flag to acheive this and if I have to I will, but do not want to have rely on programmers that use the field to check the valid flag in other places. I just want the other events to be dropped from the queue.

Use Detach Listeners, this will be more helpfull for you…

The problem with that is two fold. One I would have the reattach the listeners later. Second I have to know what controls to detach listeners from. Both of which I most likely would not know, if a custom component is the one that needs to stop all other events that might have been triggered.

I don’t think this is possible, not easily anyway. There’s no API for it, and implementing the functionality would be tricky because the two events aren’t necessarily multiplexed into the same request. Thus, there’s no physical “queue” that could be flushed - there would have to be some sort of way to say “ignore the next click RPC for this component that comes over the wire”.

Okay, not really a big deal. Just would make somethings a little eaiser. Such a click on the button leaving field with an invalid value. The button click would not have to check to see if all value was valid before proceeding. It just would never get fired.

This is the validation Iam doing It works for me

textField.addValidator(new StringLengthValidator(
" Your message", 0, 100,