检查extjs中表单发送的值

时间:2012-06-01 09:37:14

标签: forms extjs submit handler sencha-architect

我在extjs中使用字段集并想要提交值。现在我想用警报检查值,但我不明白我怎么做。

{
   "xtype": "fieldset",
   "height": 377,
   "id": "configurationDriversConfiguration",
   "width": 648,
   "layout": {
      "type": "auto"
   },
   "collapsible": true,
   "title": "Driver Configuration",
   "items": [
      {
         "xtype": "button",
         "id": "configurationDriversAdd",
         "text": "Add"
      },
      {
         "xtype": "button",
         "id": "configurationDriversDelete",
         "text": "Delete"
      },
      {
         "xtype": "textfield",
         "id": "configurationDriversCode",
         "fieldLabel": "Driver Code"
      },
      {
         "xtype": "textfield",
         "id": "configurationDriversName",
         "fieldLabel": "Driver Name"
      },
      {
         "xtype": "textfield",
         "id": "configurationDriversLicense",
         "fieldLabel": "Driver License nr"
      },
      {
         "xtype": "textfield",
         "id": "configurationDriversGivenName",
         "fieldLabel": "Driver Given Name"
      },
      {
         "xtype": "textfield",
         "id": "configurationDriversFamilyName",
         "fieldLabel": "Driver Familiy Name"
      },
      {
         "xtype": "textfield",
         "id": "configurationDriversPhone",
         "fieldLabel": "Driver Phone Nr"
      },
      {
         "xtype": "textfield",
         "id": "configurationDriversEmail",
         "fieldLabel": "Driver Email"
      },
      {
         "xtype": "combobox",
         "id": "configurationDriversProvider",
         "fieldLabel": "Provider",
         "displayField": "name",
         "store": "comboProviders",
         "valueField": "id"
      },
      {
         "xtype": "textareafield",
         "id": "configurationDriversMemo",
         "fieldLabel": "Memo"
      },
      {
         "xtype": "button",
         "height": 37,
         "id": "configurationDriversSave",
         "text": "Save"
      }
   ]
}

是我的代码吗?当我点击保存时,我想要查看所有值。我使用Sencha Architect而无法找到此

的处理程序

1 个答案:

答案 0 :(得分:0)

在“保存”按钮定义中添加如下内容:

handler: function(btn) {
   var fieldSet = btn.up('fieldset');
   Ext.Array.each(fieldset.items, function(i) {
       console.log(i.getValue());
   });
}