3 Replies Latest reply on May 29, 2012 10:28 PM by blossoms_bubbles

    SetFocus on Username (in login page) in Web app

    blossoms_bubbles

      Hello,

       

      I am having a Web App with start state as the login form. As soon as the application's creation is done, I want to set focus on username field in login form.

       

      For this I tried to use javascript method setBrowserFocus as below:

      function setBrowserFocus()

      {

                 //alert("in setBrowserFocus");

                var appObj = document.getElementById("${application}");

                if (appObj )

                {

                         appObj .tabIndex = 0;

                         appObj .focus();

                }

      }

       

      I call this JS method on creationComplete. My creationCompleteHandler() is as below:

       

      private function oncreationComplete():void

      {

      if (ExternalInterface.available)

      {

                  ExternalInterface.call("setBrowserFocus");

      }

       

      txtUserName.setFocus();

      }

       

      This draws the focus (blue rectangle) around the username textInput but it doesnt't set cursor in it. So I can't type anything in the username field until I manually click it.

       

      Also, I tried to use addedToStage="stage.focus = null;" but it also didn't help.

       

      Please help me to solve this problem.

       

      Thanks in advance.