3 Replies Latest reply on Sep 23, 2011 5:35 AM by bucpatr1

    Form when it  passes validation the validatator errors show:

    nikos101 Level 2

      For some reason in this form when it submits successfully (passes validation) the validatator errors show:

       

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

      <s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"

               xmlns:s="library://ns.adobe.com/flex/spark"

               xmlns:mx="library://ns.adobe.com/flex/mx"

               xmlns:layouts="views.layouts.*"

           creationComplete="creationCompleteHandler(event)"

               skinClass="views.skins.BlueTopPanelSkinWithBlueRedGradient" title="Log in" xmlns:parsley="http://www.spicefactory.org/parsley">

       

          <s:layout>

              <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>

       

          </s:layout>

          <fx:Script>

              <![CDATA[

                  import model.vo.AuthenticateUserParams;

                  import model.vo.WindowsActiveDirectoryUser;

       

                  import mx.collections.ArrayCollection;

                  import mx.controls.Alert;

                  import mx.events.FlexEvent;

       

                  import parsleyMessages.UserLoginRequest;

       

       

                  [MessageDispatcher]

                  [Bindable]

                  public var dispatcher:Function;

       

       

       

       

                  protected var validators:Array;

       

                  protected function creationCompleteHandler(event:FlexEvent):void

                  {

                      validators = [usernameValidator, passwordValidator];

       

                  }

       

       

                  protected function login_clickHandler(event:MouseEvent):void

                  {

                      if(Validator.validateAll(validators).length > 0)

                          return;

       

                      var params:AuthenticateUserParams= new AuthenticateUserParams();

                      params.domain = domain.selectedItem;

                      params.password = password.text;

                      params.username= username.text;

                      dispatcher(new UserLoginRequest(params));

                      clearFields();

       

       

                  }

       

                  public function clearFields():void

                  {

                      username.text = '';

                      password.text = '';

                      domain.selectedIndex = 0;

                  }

       

       

              ]]>

          </fx:Script>

          <fx:Declarations>

              <mx:Validator id="usernameValidator" property="text" required="true" source="{username}"/>

              <mx:Validator id="passwordValidator" property="text" required="true" source="{password}"/>

       

       

          <parsley:Configure />

          </fx:Declarations>

       

          <s:Form>

              <s:FormItem label="Enter username" color="#000000">

       

                  <s:TextInput id="username" x="761" y="357" width="131" text="kisn"/>

              </s:FormItem>

       

       

              <s:FormItem label="Enter password">

       

       

                  <s:TextInput id="password" x="825" y="142.25" width="132" displayAsPassword="true"

                               text="555"/>

              </s:FormItem>

              <s:FormItem label="Log on to">

       

                  <s:DropDownList id="domain" x="825" y="172.25" width="132"

                                  dataProvider="{ new ArrayCollection(['HO', 'mM'])}"

                                  selectedIndex="0">

       

                  </s:DropDownList>

       

       

              </s:FormItem>

              <s:FormItem width="100%">

                  <s:Button id="login" x="115" width="125" height="31" label="Login"

                            click="login_clickHandler(event)" cornerRadius="10" fontSize="16"

                            fontWeight="bold">

       

                  </s:Button>

              </s:FormItem>

          </s:Form>

       

      </s:Panel>