表单提交忽略 url 选项
我正在尝试以标准方式提交 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会通过将此行替换为您认为正在设置的硬编码 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.