1 Reply Latest reply on Dec 3, 2009 12:52 AM by paul.williams

    New Bug ? (resouceManager VS mx:NumberValidator) !

    acoquinar Level 1

      I made a form in a popup window containing some textinput fields that must only take numeric values. (So i am using mx:NumberValidator)

       

      If i change the displayed language (i.e. resourceManager.localeChain = ['fr_FR'];)  just before showing this dialog box, clicking the submit button will no longer call the validator !!! (Nothing happens when clicking "Ok". I have to click "Cancel" to close it)

       

      Of course, it works great if i do not change the UI language before triggering the form.

       

      Here is the code :

       

      <?xml version="1.0" encoding="utf-8"?>

       


      <mx:Panel title="Some Title" xmlns:mx="http://www.adobe.com/2006/mxml" paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10" backgroundAlpha="0.9">

       

       

       

          <mx:Script>
              <![CDATA[
             
              import mx.managers.PopUpManager;
              import mx.controls.Alert;

       

              private function okHandler (event:Event):void
              {
                  PopUpManager.removePopUp(this);
              }
              private function cancelHandler (event:Event):void
              {
                  PopUpManager.removePopUp(this);

       

              }       
              ]]>
          </mx:Script>

       

              <mx:NumberValidator allowNegative="false" source="{portNumber}" property="text" integerError="Some Error Message..."
              minValue="0" maxValue="65535" domain="int"
              trigger="{submit}" triggerEvent="click"
              valid="okHandler(event);"/>

       


      <mx:Form>
         
          <mx:FormItem label="Port">
              <mx:TextInput id="portNumber"/>
          </mx:FormItem>

       

          <mx:FormItem label="Usage">
              <mx:TextInput id="usage"/>
          </mx:FormItem>
          <mx:FormItem label="Status">
              <mx:ComboBox id="statusComboBox">
                  <mx:dataProvider>
                      <mx:Array>
                          <mx:String>Closed</mx:String>
                          <mx:String>Open</mx:String>
                      </mx:Array>
                  </mx:dataProvider>
              </mx:ComboBox>
          </mx:FormItem>
         
          <mx:HBox horizontalAlign="center">
              <mx:Button id="submit" label="Ok" />
              <mx:Button id="cancel" label="Cancel" click="cancelHandler(event)"/>
          </mx:HBox>

       

      </mx:Form>
         
      </mx:Panel>