1. #1
    Ext User
    Join Date
    May 2009
    Posts
    1
    Vote Rating
    0
    vagabondo23 is on a distinguished road

      0  

    Question FormPanel+TabPanel submit only the active tab?

    FormPanel+TabPanel submit only the active tab?


    Hi at all , I need some help about the possibilities of submit only the active tab between different tab that has been rendered ,is it possible?
    thanks in advance

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    sure, quick solution: put a form panel in each tab, get the active, call it's getForm().submit() method.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Location
    Canada
    Posts
    14
    Vote Rating
    0
    samiswt is on a distinguished road

      0  

    Default


    I hope you've already got your answer. You know, I've been struggling to solve the same problem recently. When I did it and I'm trying to search a better solution in this forum. Please, everybody, share your ideas!

    The problem may be in the ValidationStatus.js and the line number is 89.
    this.basicForm.getFields().each(function(f) means get each field in your formpanel,even if your tab is hidden.

    My idea is to set the hidden tab.disable(true) and it works.

    Platform: Win 7 64-bit
    Ext: ext-4.1.1a
    WebServer: apache 2.2

    /* my js code is below:*/
    var fp = Ext.create('Ext.form.FormPanel', {
    renderTo: Ext.getBody(),
    id: 'status-form',
    title: 'your title',
    bodyStyle: 'padding:5px 5px 0 5px',
    width: 630,
    fieldDefaults: {
    labelAlign: 'top',
    msgTarget: 'side',
    align: 'middle'
    },
    defaults: {
    //border: false,
    xtype: 'panel',
    flex: 0
    },

    layout: 'hbox',
    items: [
    {
    defaults: {
    /*
    *===================== To set the distance between the two tabs
    */
    margin: '5 5 10 5'
    },
    items: [
    tabsFrom,
    tabsTo,
    rbDateType,
    ctDateTime
    ]
    }
    ],
    dockedItems: [{
    xtype: 'toolbar',
    dock: 'bottom',
    ui: 'footer',
    items: ['->', {
    text: 'Submit',
    handler: function(){
    var aTabFrom = Ext.getCmp('tabWhereFrom').getActiveTab();
    // var aTabIdxFrom = Ext.getCmp('tabWhereFrom').items.findIndex('id', aTabFrom.id);
    var iTabsFromCount = Ext.getCmp('tabWhereFrom').items.getCount();

    var aTabTo = Ext.getCmp('tabWhereTo').getActiveTab();
    // var aTabIdxTo = Ext.getCmp('tabWhereTo').items.findIndex('id', aTabTo.id);
    var iTabsToCount = Ext.getCmp('tabWhereTo').items.getCount();

    for(i = 0; i < iTabsFromCount; i++){
    var aTab = Ext.getCmp('tabWhereFrom').items.get(i);
    if(aTab != aTabFrom){
    aTab.disable(true);
    }
    }

    for(i = 0; i < iTabsToCount; i++){
    var aTab = Ext.getCmp('tabWhereTo').items.get(i);
    if(aTab != aTabTo){
    aTab.disable(true);
    }
    }

    if(fp.getForm().isValid()){
    var sb = Ext.getCmp('form-statusbar');
    sb.showBusy('searching...');
    fp.getEl().mask();
    alert('this is a test!');

    }
    else{
    alert('error isValid!');
    }

    }
    }]
    },
    Ext.create('Ext.ux.StatusBar', {
    dock: 'bottom',
    id: 'form-statusbar',
    defaultText: 'Ready',
    plugins: Ext.create('Ext.ux.statusbar.ValidationStatus', {form:'status-form'})
    })]
    });

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Location
    Canada
    Posts
    14
    Vote Rating
    0
    samiswt is on a distinguished road

      0  

    Default


    by the way, even if you deleted the status bar, formpanel still tried to get all fields in it.