Closed GoogleCodeExporter closed 8 years ago
I think this problem is a side effect of:
a) Event ordering (i.e. GWT event handlers fire in the order they are added).
b) Conditions cache their values hence only update on value change events
(instead of recomputing everytime getValue() is called).
So in the above example triggerValidate() will execute before the textOf(..)
condition has recomputed based on the change.
The simplest solution in this case (if I'm correct) is to add your handlers
that trigger validation after you've configured your validators. I would
recommend documenting it in the comments (c:
Another option is to execute the validation step using a DeferredCommand, but
I'd only do this as a last resort as you loose control over when the validation
happens.
This is a bit of a Gotcha with event programing, so I should definitely add it
to the Wiki.
Let me know if this is the issue and I'll close it.
Cheers
Andrew
Original comment by andrew.pietsch
on 14 Sep 2010 at 4:06
Thanks for your great answer,
a) was the problem, when i moved the addValueChangeHandler behind the
validateField( it works correct.
Greet Rainer
Original comment by woc...@gmail.com
on 14 Sep 2010 at 6:54
No worries. I'll close this issue.
Cheers
Andrew
Original comment by andrew.pietsch
on 14 Sep 2010 at 7:40
Original issue reported on code.google.com by
woc...@gmail.com
on 13 Sep 2010 at 6:56