Clear validation on textInput when validation is not enabled
Posted
by Jon
on Stack Overflow
See other posts from Stack Overflow
or by Jon
Published on 2009-07-13T17:44:08Z
Indexed on
2010/06/11
0:22 UTC
Read the original article
Hit count: 635
Hi,
I've created a custom textInput componenet that handles it's own validation using a private validator. The validation is enabled depending on the state of the component i.e. validation is enable when the components state is "edit".
However, when the state changes from edit the internal validator is set to not enabled but the validation errors on the textbox do not clear - the textInput still has the red border and on mouseover the validation errors come up. What I want to happen is that when a validator is disabled the error formatting and error messages clear from the text input control.
Does anyone have any idea how to do this I tried setting the internal validator instance to enabled = false and dispatching a new focusOutEvent as below but the validation error formatting is still applied to the textInput contrl.
_validatorInstance.enabled = false;
//clear the validation errors if any
dispatchEvent(new FocusEvent(FocusEvent.FOCUS_OUT));
Any ideas?
Thanks
Jon
© Stack Overflow or respective owner