2012-06-01 31 views
0

我在extjs中使用了一個字段集,並且想要提交這些值。現在我想用一個警報檢查值,但我沒有看到我能做到這一點。檢查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" 
      } 
   ] 
} 

是我的代碼。當我點擊保存時,我想查看所有的值。我用煎茶架構師,找不到這個

+0

你到底需要什麼?檢查值是什麼?你在尋找某種驗證嗎? – sha

+0

驗證會很好。但我需要的是,當我按下保存它做了一些事情:)並看看它是什麼,我想看到提交的值。例如什麼是填充在configurationDriversName –

回答

0

的處理程序添加像這樣的「保存」按鈕定義:

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

我這樣做:處理程序:功能(按鈕,事件){ var fieldSet = button.up('configurationDriversConfiguration'); Ext.Array.each(fieldSet.items,function(i){alert(i.getValue()); }); } ,但我得到一個字段是不確定的 Ext.Array.each(fieldSet.items,功能(I){ 錯誤 –

+0

我認爲,如果你需要,你需要指定選擇#my_id ID查找,沒有任何事情 - 這將是xtype – sha

+0

ow好吧對不起。改變了這一點。現在我得到:我是undefined .... –