DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Thomas has posted 33 posts at DZone. View Full User Profile

Reset Form Validation Warnings In Flex

  • submit to reddit
        Validators declaration: 
<mx:Array id="validators">
  <mx:StringValidator source="{numberEditor}" property="text" required="true" minLength="3" />
  <mx:StringValidator source="{nameEditor}" property="text" required="true" />
AS3 code: 
public function resetForm():void {
  formObject = new formObject(); // the object the form editors (TextInput / ComboBox / etc...) are binded to

private function resetValidationWarnings():void {
  for each (var validator:Validator in validators) {
    UIComponent(validator.source).errorString = "";