0 Replies Latest reply on Aug 22, 2007 4:39 AM by Ami11

    Validation Issue

    Ami11
      Hi all,

      I am developing a login form and as usual, I have 2 textInput controls. I have emailValidator and a stringValidator on those textInputs. Now I want that the login details should get submitted on pressing enter key in any of the TextInput control. It requires me to do focus out and then press enter to fire the service. Following is the code.

      <mx:EmailValidator id="emailV" source="{emailTextInput}"
      valid="emailValidator=true;" property="text"
      requiredFieldError="Please enter username"
      invalid="{emailValidator=false;}"/>


      <mx:StringValidator id="passwordV" source="{passwordTextInput}" property="text"
      required="true" requiredFieldError="Please enter password"
      invalid="{passwordValidator=false;}"
      valid="passwordValidator=true;" minLength="4"/>



      public function login():void
      {
      if(emailValidator==true && passwordValidator==true)
      {
      loginModel.loginVO.email=emailTextInput.text;
      loginModel.loginVO.password=passwordTextInput.text;
      var loginEvent:LoginEvent=new LoginEvent(loginModel.loginVO);
      CairngormEventDispatcher.getInstance().dispatchEvent(loginEvent);
      }
      }
      Please suggest me what I can do to solve this. Thanks in advance.