Search code examples
extjsmodx

Form submission ignoring url option


I'm trying to submit an ExtJs form the standard way, but the form is always submitting to the same page am not sure why although the url config option is correctly set

Players.panel.Subscription = function(config) {
    config = config || {};
    Ext.apply(config,{
        id : 'players-subscription-home'
        ,border: false
        ,baseCls: 'modx-formpanel'
        ,standardSubmit: true
        ,baseParams: { action: 'mgr/player/getSubscribers' }
        ,url: Players.config.connectorUrl
        ,buttons: [{
            text: 'Export Subscribers'
            ,type: 'submit'
            ,handler:  function(){
                var fp = this.ownerCt.ownerCt,
                    form = fp.getForm();
                alert(fp.url);
                if (form.isValid()) {
                    // check if there are baseParams and if
                    // hiddent items have been added already
                    if (fp.baseParams && !fp.paramsAdded) {
                        // add hidden items for all baseParams
                        for (i in fp.baseParams) {
                            fp.add({
                                xtype: 'hidden',
                                name: i,
                                value: fp.baseParams[i]
                            });
                        }
                        fp.doLayout();
                        // set a custom flag to prevent re-adding
                        fp.paramsAdded = true;
                    }
                    form.submit();
                }
            }
        }]
    });
    Players.panel.Subscription.superclass.constructor.call(this,config);
};

Ext.extend(Players.panel.Subscription,MODx.FormPanel);
Ext.reg('players-subscription-home',Players.panel.Subscription);

Thanks.


Solution

  • I would troubleshoot by replacing this line with a hardcoded URL that you think is being set: Players.config.connectorUrl

    Then see if you are still seeing the same behavior.