表单提交忽略 url 选项

发布于 2024-11-30 01:57:04 字数 1716 浏览 1 评论 0原文

我正在尝试以标准方式提交 ExtJs 表单,但表单始终提交到同一页面,尽管 url 配置选项设置正确,但我不确定为什么,

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);

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

又怨 2024-12-07 01:57:04

我会通过将此行替换为您认为正在设置的硬编码 URL 来进行故障排除:
Players.config.connectorUrl

然后看看您是否仍然看到相同的行为。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文