1. #1
    Sencha User dorgan's Avatar
    Join Date
    Dec 2007
    Location
    Cocoa, FL
    Posts
    286
    Vote Rating
    -1
    dorgan is an unknown quantity at this point

      0  

    Default form.Field Override

    form.Field Override


    I put together this simple override that will add a class to a form fields label on focus. The way I used it was i made the default text color of field labels lighter and made it so the focus class has a darker color.

    Maybe this is will same someone else the time of trying to put this together.....


    Code:
    Ext.override(Ext.form.Field, {
        onFocus: Ext.form.Field.prototype.onFocus.createSequence(function () {
            var formItem = this.el.up('.x-form-item', 10);
            if (formItem) {
                var label = formItem.child('.x-form-item-label');
                if (label) {
                    label.addClass('x-form-item-label-focus');
                }
            }
        }),
        onBlur: Ext.form.Field.prototype.onBlur.createSequence(function () {
            var formItem = this.el.up('.x-form-item', 10);
            if (formItem) {
                var label = formItem.child('.x-form-item-label');
                if (label) {
                    label.removeClass('x-form-item-label-focus');
                }
            }
        })
    });
    

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Very nice!
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.