您好我正在尝试解决我的成功和失败处理程序。我有一个删除数据的按钮。但只是为了建立基本连接,我正在尝试提交我的表单。我在java2s.com网站上使用了这段代码。
所以我给了一个url,表单必须张贴,返回时应显示警告,无论是成功还是失败。现在,当我这样做时,我的虚拟页面“x.php”正在加载。我可以通过firebug中的控制台和NET窗口看到它。
在成功或失败的回调中,我是否必须回应一些具体内容?怎么会知道它是成功还是失败?
var rem = Ext.get('remData');
new Ext.Button({
renderTo:rem,
text:'Remove',
handler:function(){
var formPanel = Ext.getCmp('form1');
formPanel.el.mask('Under Process','x-mask-loading');
formPanel.getForm().submit({
url:'x.php',
success:function(f,a){alert('+');},
failure:function(f,a){alert('_');}
});
}
});
我无法理解f会是什么?如果它们是功能和动作,它们是否通过我提交数据的URL传递给??
答案 0 :(得分:2)
您应该查看Submit action的文档。它列出了成功和失败功能所采用的参数。从文档中解释:
f
:请求操作的Ext.form.BasicForm
a
:提交表单的操作类。可以检查此对象的result
(a.result
)属性以执行自定义后处理
答案 1 :(得分:1)
查看Ext API Docs,打开Ext.form.BasicForm,找到submit()函数并查看说明。
f
是提交的表单,a
是操作。来自文档:
action : The Action object which performed the operation.
The action object contains these properties of interest:
- failureType
- response
- result : interrogate for custom postprocessing
- type