Results 1 to 3 of 3

Thread: CheckboxGroup's added items are not validating properly

    You found a bug! We've classified it as EXTJS-19701 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Mar 2011
    Location
    Arvada, CO
    Posts
    404

    Default CheckboxGroup's added items are not validating properly

    I have a CheckboxGroup class that isn't allowed to be blank, and when it's invalid, I add a red border around the class to show that it's invalid. The only catch is that my CheckboxGroup does not have its checkboxes until after I get some data, and then I make use of the add method.

    Here is an example. In this example, I have two classes, one with my checkboxes getting added manually (through the add method), and the other with the checkboxes as items (this is to help show what the issue is).

    In the Added Columns class, when I deselect the selected checkbox, the invalid cls does not show, but you can see the form's validitychange event fires. However, when I go to select the same checkbox in the Added Columns, the validitychange event doesn't fire, but if I deselect one more time, then it seems as if the validation has caught up. It seems as if there's an issue with the initial checked checkboxes.

    In the Not Added Columns class, you'll see it works as expected... deselecting shows the invalid cls (and fires validitychange), and vice versa for the selection part.

    This seems like a bug to me, but is it possible I've got something set up wrong?

    Code:
    Ext.application({
        name : 'Fiddle',
    
        launch : function() {
            Ext.define('AddedMyGroup', {
                extend: 'Ext.form.CheckboxGroup',
                xtype: 'myGroupAdded',
                labelAlign: 'top',
                fieldLabel: 'Added Columns',
                // Arrange checkboxes into two columns, distributed vertically
                columns: 2,
                vertical: true,
                allowBlank: false,
                invalidCls: 'invalid-form-entry',
                border: 1,
                style: {
                    borderColor: 'white',
                    borderStyle: 'solid'
                },
                initComponent: function() {
                    this.callParent();
                    this.add([
                        { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
                        { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
                        { boxLabel: 'Item 3', name: 'rb', inputValue: '3'},
                        { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
                        { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
                        { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
                    ]);
                    this.validate();
                }
            });
            Ext.define('NotAddedMyGroup', {
                extend: 'Ext.form.CheckboxGroup',
                xtype: 'myGroupNotAdded',
                fieldLabel: 'Not Added Columns',
                // Arrange checkboxes into two columns, distributed vertically
                columns: 2,
                labelAlign: 'top',
                vertical: true,
                allowBlank: false,
                invalidCls: 'invalid-form-entry',
                border: 1,
                style: {
                    borderColor: 'white',
                    borderStyle: 'solid'
                },
                items: [
                        { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
                        { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
                        { boxLabel: 'Item 3', name: 'rb', inputValue: '3'},
                        { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
                        { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
                        { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
                    ]
            });
            Ext.create('Ext.form.Panel', {
                title: 'Checkbox Group',
                bodyPadding: 10,
                renderTo: Ext.getBody(),
                height: 400,
                defaults: {
                    flex: 1
                },
                layout: {
                    type: 'hbox',
                    align: 'stretch'
                },
                listeners: {
                    validitychange: function(form, isValid) {
                        console.log('validitychange', isValid);
                    }
                },
                items:[{
                    xtype: 'myGroupAdded',
                    reference: 'myGroupAdded'
                }, {
                    xtype: 'myGroupNotAdded',
                    reference: 'myGroupNotAdded'
                }]
            });
        }
    });

  2. #2
    Sencha - Support Team bjdurham85's Avatar
    Join Date
    Mar 2014
    Posts
    962

    Default

    Hi--,

    Thanks for the info, I've opened a bug in our tracking system.

    Regards,
    Bryan

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    7

    Default

    this problem came with extjs since version 2. This is incredible .

Similar Threads

  1. Validation not working correctly after checking items in checkboxgroup
    By jusmeig in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 13 Jan 2012, 10:17 AM
  2. ExtJS 4 checkboxgroup validation
    By harman in forum Community Discussion
    Replies: 0
    Last Post: 26 Jul 2011, 3:45 AM
  3. CheckBoxGroup Validation / Validator
    By The_Jackal in forum Ext GWT: User Extensions and Plugins
    Replies: 0
    Last Post: 9 Aug 2010, 6:53 PM
  4. Checkboxgroup validation
    By Jangla in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 4 Aug 2009, 5:12 AM
  5. [2.2] CheckboxGroup Custom Validation
    By srajakaruna in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 20 Aug 2008, 12:28 AM

Posting Permissions

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