0 Replies Latest reply on Oct 5, 2009 1:09 PM by RedOctober57

    Setting focus on text input not working the way one would expect

    RedOctober57

      I have a click handler on a button called "btnGo".  During the processing of this function, I want to remove the text from the text input, and set focus to the text input.  The following code is my feeble attempt at doing this.  It doesn't work.  The text input called edtSrch will have it's text removed (which is what I want), however, the cursor is not inside the text input control and it doesn't have focus.  What am I doing wrong?

       

                  protected function btnGo_clickHandler(event:MouseEvent):void
                  {
                      // I fetch a bunch of records ("items"?)
                      getSBJsResult.token = baa_data_svc.getSBJs(edtSrch.text);

                      //  Blank the text, set text input to have focus, waiting for next word to be typed in

                     edtSrch.text = '';
                     edtSrch.setFocus();

       

       

      Goal:  To allow the user to be able to type in a word, press the Enter key on the keyboard, the records that contain the word typed in the text input are displayed, and the text input text is cleared and the cursor remains in the text input control waiting for the next word to be typed in.  Note:  I have the "btnGo being fired upon pressing the Enter key" part working ok.  It's the clearing of the text input and the refocusing of it, that is not working.

       

       

      Thanks in advance.