I have a form with a few TextInput components. I have a TextInput with
a NumberValidator as one of the form items. On this TextInput I have
coded the valid and invalid events to populate other fields depending
on what has been entered. My experience is that the valid event is not
working correctly.

I have this sample code to illustrate:

in the first field enter 10, the valid event does not fire
in the first field enter 200, the invalid event fires correctly.
in the first field enter 10, the valid event does work now
in the first field enter 20, the valid event does not fire.

Any ideas. What I want is a way to fire an event after the validator
has completed, the valueCommit and FocusOut seem to fire before the
validator has completed.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
  <mx:Script><![CDATA[
    private function testA():void {
      msgTXT.text = "Valid: " + testTXT.text;
    }
    private function testB():void {
      msgTXT.text = "Invalid: " + testTXT.text;
    }
  ]]></mx:Script>
  <mx:NumberValidator source="{testTXT}" property="text" minValue="1"
maxValue="99"/>
  <mx:VBox>
    <mx:Form>
      <mx:FormItem label="Integer">
        <mx:TextInput id="testTXT" valid="testA()" invalid="testB()"/>
      </mx:FormItem>
      <mx:FormItem label="Message">
        <mx:TextInput id="msgTXT" editable="false" width="160"/>
      </mx:FormItem>
    </mx:Form>
  </mx:VBox>
</mx:Application>

Thanks

Andrew

Reply via email to