Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 提交按钮的处理程序_Forms_Extjs_Handler - Fatal编程技术网

Forms 提交按钮的处理程序

Forms 提交按钮的处理程序,forms,extjs,handler,Forms,Extjs,Handler,我想在extjs中使用一个表单保存按钮。这就是我作为一个处理者所拥有的 { xtype: 'button', handler: function(button, event) { var form = this.getForm(); if (form.isValid()) { Ext.MessageBox.alert('Submitted Values', form.getVa

我想在extjs中使用一个表单保存按钮。这就是我作为一个处理者所拥有的

{
         xtype: 'button',
         handler: function(button, event) {
             var form = this.getForm();
             if (form.isValid()) {
                Ext.MessageBox.alert('Submitted Values', form.getValues(true));
                                 }
                                           },
          height: 37,
          id: 'configurationDriversSave',
          text: 'Save'
}
我现在在firebug中得到的只是一个错误:this.getForm不是一个函数。我做错了什么

this.getForm
在Firefox中不受支持, 使用
document.forms

或者您也可以从中获取任何引用。

在处理程序
中,此
将引用按钮本身。您可以在firebug中检查,按钮当然没有方法
getForm()
。您需要调用类似“this.up('form')”的东西

第二件事-你不必像你试图做的那样进行手动验证。ExtJs具有表单的内置验证机制。

根据,您只需使用
this.form
访问包含生成事件的元素的表单元素

因此,与其

var form = this.getForm();
使用

var form = this.form;