0 Replies Latest reply on Mar 28, 2008 2:00 PM by andbin

    NumberValidator with strange behaviour

    andbin
      Hi, I am quite new to Flex, I am trying to use a NumberValidator but I have noticed a strange behaviour:


      <?xml version="1.0" encoding="iso-8859-1" ?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

      <mx:NumberValidator source="{valueFrom}" property="text" domain="real"
      trigger="{valueFrom}" triggerEvent="enter" />

      <mx:Panel title="Test" height="100%" width="100%"
      paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

      <mx:TextInput id="valueFrom" valid="valueTo.text=valueFrom.text" invalid="valueTo.text=''" />
      <mx:TextInput id="valueTo" editable="false" />

      </mx:Panel>
      </mx:Application>


      If the input in valueFrom is valid, the content should be copied in valueTo, otherwise valueTo should be cleared.
      But if I insert a valid value eg. "12" and press return, the value is not copied! I must mistake the value eg. "12xy" and press return (the valueTo field is cleared) and only the next time if I insert a valid value eg. "12" and return, the value is copied. And this continues so on .... I must mistake the value and only the next time it is accepted.

      It's very possible I haven't understood how to use NumberValidator or I haven't use it correctly. Please, tell me. Thanks.