Results 1 to 5 of 5

Thread: Checkbox group with textbox

  1. #1
    Sencha User
    Join Date
    May 2013
    Posts
    64
    Answers
    2

    Default Answered: Checkbox group with textbox

    Hi, I want to create a checkbox group for which one checkbox should contain a textbox.. Something like below.Checkbox group.PNG

  2. Here is the post .. It uses radio, but you get the idea.

    Code:
    Ext.require('*');
    
    Ext.onReady(function() {
    
        var panel = Ext.create('Ext.container.Container', {
            renderTo: Ext.getBody(),
            items: [{
                xtype: 'radiogroup',
                fieldLabel: 'Select',
                columns: 1,
                vertical: true,
                items: [{
                    boxLabel: 'Value 1',
                    inputValue: '1',
                    checked: true,
                    name: 'inputname',
                    listeners: {
                        change: function(field, newValue, oldValue) {
                            if (newValue) panel.down('textfield').hide();
                        }
                    }
                }, {
                    boxLabel: 'Other',
                    inputValue: '2',
                    name: 'inputname',
                    listeners: {
                        change: function(field, newValue, oldValue) {
                            if (newValue) panel.down('textfield').show();
                        }
                    }
                }]
            }, {
                xtype: 'textfield',
                hidden: true, // or use disabled; and set enable(),disable()
                fieldLabel: 'My Text'
            }]
        });
    
    });

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Have a look at: (same premise)
    http://www.sencha.com/forum/showthread.php?242007

  4. #3
    Sencha User
    Join Date
    May 2013
    Posts
    64
    Answers
    2

    Default

    I got " do not have permission to access this page" error..
    permission.PNG

  5. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Here is the post .. It uses radio, but you get the idea.

    Code:
    Ext.require('*');
    
    Ext.onReady(function() {
    
        var panel = Ext.create('Ext.container.Container', {
            renderTo: Ext.getBody(),
            items: [{
                xtype: 'radiogroup',
                fieldLabel: 'Select',
                columns: 1,
                vertical: true,
                items: [{
                    boxLabel: 'Value 1',
                    inputValue: '1',
                    checked: true,
                    name: 'inputname',
                    listeners: {
                        change: function(field, newValue, oldValue) {
                            if (newValue) panel.down('textfield').hide();
                        }
                    }
                }, {
                    boxLabel: 'Other',
                    inputValue: '2',
                    name: 'inputname',
                    listeners: {
                        change: function(field, newValue, oldValue) {
                            if (newValue) panel.down('textfield').show();
                        }
                    }
                }]
            }, {
                xtype: 'textfield',
                hidden: true, // or use disabled; and set enable(),disable()
                fieldLabel: 'My Text'
            }]
        });
    
    });

  6. #5
    Sencha User
    Join Date
    May 2013
    Posts
    64
    Answers
    2

    Default

    Thanks Scott

Posting Permissions

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