Results 1 to 2 of 2

Thread: Dynamically adding multiple panels to a form

  1. #1
    Sencha User
    Join Date
    Sep 2010
    Location
    Hyderabad, India
    Posts
    29

    Post Dynamically adding multiple panels to a form

    I have 3 panels and each panel will have 7 - 10 fields.The main form panel contains a combo field and the 3 panels.Based on the combo selected value i'm hiding the remaining 2 panels and showing one panel.All these three panels have allowBlank: false validations for the fields.



    While submitting the form, the fields which are hidden are also validated and prevents the form from submitting. So i want to disable the fields which are hidden. i'm using this code.


    Code:
    question_multiple_option.query('.component').forEach(function(c){c.setDisabled(true);});
    But in EXT 4.X disabled fields are also validated while submitting a form.In Ext 2.X and 3.X disabled fields are not validated and not submitted.



    previously i used this code in ext 2.X


    Code:
    Ext.getCmp('option').cascade(function(comp){ 
                           if (comp.isFormField) { 
                         //comp.enable();
                          comp.disable(); 
                           }
                        });
    Is it the right way to implement a form with multiple panels by hide and showing the panels. Or how can i add / remove a panel to a form dynamically ?.Is there any better way to implement this kind of form.Thank you.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    isValid doesn't do any checking of disabled or anything, it simple goes through all the fields and validates it:

    Code:
        isValid: function() {
            var me = this,
                invalid;
            me.batchLayouts(function() {
                invalid = me.getFields().filterBy(function(field) {
                    return !field.validate();
                });
            });
            return invalid.length < 1;
        },
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

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
  •