I extended the TextInput component and create an instance variable called "_validator" on the new text input to hold custom validations on a form. I have named this new extended text input of MyTextInput.
So, in my form, I have 30 MyTextInputs, each with it's own custom validator setted on "_validator" property.
When I need to validate all the 30 inputs, I do a loop on all inputs and call "_validator.validate()".
Everything works fine till here...
But now, due to my business logic, I need a different validator (a special configured String validator) for 8 of my MyTextInputs on the form, but I cannot lose the "_validator" object already setted on these components, because I'll use them later. To accomplish this, I have created a new instance of the SpecialConfiguredStringValidator, and iterate over the 8 target MyTextInputs , passing each MyTextInput to the source property of SpecialConfiguredStringValidator. After this, I call validate() method.
Ok, validations occurred with 2 issues (both, after SpecialConfiguredStringValidator.validate() is called):
1°: if I call again "_validator.validate()" method and it returns VALID, the red borders and the red tool tip does not disappear , until I call myTextInput.errorMessage = ""
2° The requiredFieldError message is being duplicated on the component.... for example.. if I call SpecialConfiguredStringValidator.validate() 4 times,
the message on the red error tooltip of MyTextInput will be:
For each time i call SpecialConfiguredStringValidator.validate(), the errorString receives a new line of "Required field" message
somebody knows why this happens?
i am missing something of the life cycle of the component? or just doing wrong validations?