2 Replies Latest reply on Apr 1, 2011 6:48 PM by huangxinghui

    UIComponent validator question

    huangxinghui Level 1

      i use flex 3.5 sdk

       

      i have a textinput and have several validations on it, then i want click a button named "Reset" to reset the textinput content and clear the red border

       

      i do like this

       

      textInput.text = "";
      textInput.errorString = "";
      

       

      this is wrong, because in UIComponent.as, add two array errorObjectArray and errorArray to control the validatorResult

       

      so i add a function in UIComponent.as like this

       

      /**
       * reset the errorString
       */
      public function validationResultReset():void
      {
          if (errorObjectArray != null)
          {
              errorObjectArray.splice(0, errorObjectArray.length);
              errorArray.splice(0, errorArray.length);
          }
           
          errorString = "";
      }
      

       

      then change call

       

      textInput.text = "";
      textInput.validationResultReset();
      

       

      i feel this is not a good solution, someone give me a suggestion.

       

      Thanks a lot