Results 1 to 4 of 4

Thread: FormPanel+TabPanel submit only the active tab?

  1. #1
    Ext User
    Join Date
    May 2009
    Posts
    1
    Vote Rating
    0
      0  

    Question 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 User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    86
      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
      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
      0  

    Default

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

Posting Permissions

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