Results 1 to 5 of 5

Thread: checkboxgroup validateOnChange overrides markInvalid

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    5

    Default checkboxgroup validateOnChange overrides markInvalid

    This might just be a matter of updating the docs however in the following code

    Code:
                         listeners: {
                            change: function(form,newValue,oldValue) {
                                if(Ext.isArray(newValue.resultField)) {
                                    if(newValue.resultField.length != 2){                                   
                                        form.markInvalid(['Select exactly 2 observation field']);                                   
                                    } else {                                   
                                       form.clearInvalid(); 
                                    }
                                } else {                               
                                    form.markInvalid(['Select exactly 2 observation field']);
                                }
                            }
                        }
    The above markInvalid is override by validateOnChange which defaults to true. Either update the docs so that users know this override or change the sequence validate before marking invalid.

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report. Can you please post a test case which reproduces this issue you are seeing?

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    5

    Default Standalone code test

    https://fiddle.sencha.com/fiddle/ku5

    Code:
    
    
    Code:
    Ext.application({
        name : 'Fiddle',
    
    
        launch : function() {
            Ext.create('Ext.window.Window', {
                title: 'Hello',
                height: 200,
                width: 400,
                layout: 'fit',
                items : {
                        xtype : 'checkboxgroup',                              
                        allowBlank : false,
                        fieldLabel : 'Results',
                        allowBlank : false,
                        blankText : 'Select at 2 checkbox',
                        //validateOnChange : false,
                        // Arrange radio buttons into two columns, distributed vertically
                        columns : 4,
                        vertical : true,
                        msgTarget: 'under',
                        invalidCls: Ext.baseCSSPrefix + 'form-invalid',
                        items : [ {
                            boxLabel : 'k',
                            name : 'resultField',
                            inputValue : 'k'                       
                        }, {
                            boxLabel : 'mg',
                            name : 'resultField',
                            inputValue : 'mg'                        
                        }, {
                            boxLabel : 'ca',
                            name : 'resultField',
                            inputValue : 'ca'                     
                        }, {
                            boxLabel : 'mg',
                            name : 'resultField',
                            inputValue : 'mg'               
                        }, {
                            boxLabel : 'na',
                            name : 'resultField',
                            inputValue : 'na'         
                        }],
                        listeners: {
                            change: function(form,newValue,oldValue) {
                                if(Ext.isArray(newValue.resultField)) {
                                    if(newValue.resultField.length != 2){                                   
                                        form.markInvalid(['Select exactly 2 observation field']);                                   
                                    } else {                                   
                                       form.clearInvalid(); 
                                    }
                                } else {                               
                                    form.markInvalid(['Select exactly 2 observation field']);
                                }
                            }
                        }
                     }
            }).show();
        }
    });
    
    


  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    5

    Default

    if you uncomment the validateOnChange the code will work as expected.

  5. #5
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Ah, I see it now, thanks. I found an existing report of this:
    http://www.sencha.com/forum/showthread.php?292177

    Still unresolved at this time, but I've added a note to the bug ticket referencing this thread to improve priority.

Similar Threads

  1. [OPEN] validateOnChange: false - not working
    By spatel.engg in forum Ext 5: Bugs
    Replies: 5
    Last Post: 8 Jun 2018, 5:31 AM
  2. markInvalid
    By hello in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 19 Nov 2009, 2:23 AM
  3. markInvalid
    By trophytoolbox in forum Ext GWT: Help & Discussion (1.x)
    Replies: 2
    Last Post: 2 May 2008, 10:37 AM

Tags for this Thread

Posting Permissions

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