[CLOSED] verify if Textbox has focus

  1. #1

    [CLOSED] verify if Textbox has focus

    Hi Guys,

    I was checking to see if there was a way to detect if a text box on a form has the focus from javascript. I checked the Sencha documentation but did not see such a property. Is there another way of doing this
    Last edited by geoffrey.mcgill; Mar 03, 2011 at 4:03 AM. Reason: [CLOSED]
  2. #2
    Hi,

    As far as I know there is no such method or property.

    You could manually implement it handling Focus and Blur events.

    For example, set
    this.hasFocus = true;
    in Focus listener and 'false' in Blur listener.
  3. #3
    Hi,

    A field already uses hasFocus variable and set it to true on focus event therefore just check it directly
    if(field.hasFocus){
       ....
    }
  4. #4
    I was sure that if it would be exist it would be a 'public' property/method and didn't check the sources.

    Well, I still don't understand why it's not 'public'.
  5. #5
    That worked, you can marked this as solved. thanks.

Similar Threads

  1. [CLOSED] textbox borders
    By Vasudhaika in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 10, 2015, 5:16 AM
  2. [CLOSED] add css to a textbox from code-behind
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Oct 19, 2010, 5:37 PM
  3. [CLOSED] Verify if a numberfield is empty in javascript.
    By pdcase in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 30, 2010, 8:25 PM
  4. [CLOSED] TextBox.RemoveClass
    By Steve in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 12, 2009, 2:42 PM
  5. Replies: 1
    Last Post: Dec 25, 2008, 6:32 AM

Posting Permissions