Search code examples
sencha-touch-2

Change the shadow color of the textfield when got focus


I want my textfield to get blue color shadow when the user taps on the textfield to enter text. I would like to get an example that would update the inputCls inside focus event. I have set the inpuCls while creating the textfield. I wanted to how know to add it inside FOCUS event. can anyone help me on this. thanks in advance


Solution

  • You can add a listener in your TextField that listens to the event focus.

    The listener can then change the inputCls to what you want.

    If you want, you can then listen to the blur event to revert the changes with the same logic.

    I strongly suggest you read the documentation about events :

    http://docs.sencha.com/touch/2.0.2/#!/guide/events

    EDIT : Code sample

    listeners : {
        focus: function() {
            yourTextfield.setInputCls('yourcls');
        }
    }