单击提交按钮时获取要提交的表单
我试图在单击按钮时提交表单,但是它并不像我想象的那么简单,我总是得到一个 fp.getForm 不是一个函数,尽管提交处理程序直接取自 ExtJs 文档,有什么线索吗?
Players.panel.Subscription = function(config) {
config = config || {};
Ext.apply(config,{
border: false
,baseCls: 'modx-formpanel'
,process: 'mgr/player/getSubscribers'
,standardSubmit: true
,url: Players.config.connectorUrl
,baseParams: { action: 'mgr/player/getSubscribers' }
,buttons: [{
text: 'Export er'
,formBind: true
,type: 'submit'
,handler: function(){
var fp = this.ownerCt.ownerCt,
form = fp.getForm();
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);
};
我还尝试将基类从 modx-formpanel 替换为 formpanel 和 basicform 但没有成功。
谢谢
I'm trying to submit the form when the button is clicked, however it wasn't as simple as i thought, i always end up getting a fp.getForm is not a function, although the submit handler is taken directly from the ExtJs doc, any clue?
Players.panel.Subscription = function(config) {
config = config || {};
Ext.apply(config,{
border: false
,baseCls: 'modx-formpanel'
,process: 'mgr/player/getSubscribers'
,standardSubmit: true
,url: Players.config.connectorUrl
,baseParams: { action: 'mgr/player/getSubscribers' }
,buttons: [{
text: 'Export er'
,formBind: true
,type: 'submit'
,handler: function(){
var fp = this.ownerCt.ownerCt,
form = fp.getForm();
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);
};
I also tried replacing the base class from modx-formpanel to formpanel and basicform with no success.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为你没有表单面板。试试这个:
It's because you have not a form panel. Try this: