Results 1 to 2 of 2

Thread: [2.1.1] Clickable Input Labels

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User benwhite's Avatar
    Join Date
    Oct 2010
    Columbus, OH
    Vote Rating

    Default [2.1.1] Clickable Input Labels

    Input field labels are not clickable. Why?
    I have created a simple override that will automatically set focus on the input field when it's label has been tapped.
    I'm not sure this is the best way to accomplish this, but I would like to see these enhancements added into the core Sencha Touch framework in some form or fashion.

    I have highlighted my changes from the original Ext.field.Field base code.

    //[2.1.1]PATCH - update input labels to be clickableExt.define('MyApp.override.field.Field', {
        override : 'Ext.field.Field',
        // @private
        getElementConfig: function() {
            var prefix = Ext.baseCSSPrefix;
            return {
                reference: 'element',
                className: 'x-container',
                children: [
                        reference: 'label',
                        cls: prefix + 'form-label',
                        tag: 'label', //change to be label tag rather than div
                        children: [{
                            reference: 'labelspan',
                            tag: 'span'
                        reference: 'innerElement',
                        cls: prefix + 'component-outer'
        // @private
        updateLabel: function(newLabel, oldLabel) {
            var renderElement = this.renderElement,
                prefix = Ext.baseCSSPrefix,
                cmp = this.getComponent(); //get component
            if (newLabel) {
                renderElement.addCls(prefix + 'field-labeled');
            } else {
                renderElement.removeCls(prefix + 'field-labeled');
            //update the label's "for" attribute now that we have a field id assigned
            this.label.dom.setAttribute('for', (cmp.input && || ''); 

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    Moved to the bugs forum to open up as a feature request.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts