0 Replies Latest reply on Feb 13, 2007 6:46 PM by jamProg

    Validators - Event Listening

    jamProg Level 1
      I need to change the trigger event for a validator so it checks as soon as information is entered in a text area.
      1. Currently I have to click on something else before the Validator checks to see if anything is in the text area. I would like it to check as soon as data is entered into the text area. (like somehow linking it to the dataChange event of the text Area)
      NB The Validator is attached to a custom component that is dynamically created when the application is run.

      2. I have a group of labels which change color based on the validator when it is clicked on. Likewise each label only updates when I click on another label and then click back on the original label. I am somewhat new to Flex 2 so I am a bit confused about how event listening works and how events can be handled.

      My code follows below:

      // Event listener for the valid and invalid events - in script
      public function handleValid(eventObj:ValidationResultEvent):Boolean
      {
      if(eventObj.type==ValidationResultEvent.VALID){
      isValid = true;
      }
      else
      {
      isValid = false;
      }
      return isValid;
      }

      // Constructor
      <mx:Validator id="reqValid" required="true"
      source="{feedbackText}" property="text"
      valid="handleValid(event)" invalid="handleValid(event)"/>