2011-03-15 59 views
0

我無法提交單選按鈕值。我有兩個單選按鈕,如下所示:Extjs使用單選按鈕和getFieldValues

{ 
xtype: 'radio', 
fieldLabel: 'Employment Type', 
boxLabel: 'Documented', 
name: 'employment_type', 
checked: true, 
inputValue: 'documented' 
}, 
{ 
xtype: 'radio', 
boxLabel: 'Contracted', 
name: 'employment_type', 
inputValue: 'contracted' 
} 

我使用AJAX調用以這種方式提交表單。

var myParams = { 
employee: form.getFieldValues() 
} 

Ext.Ajax.request({ 
url: '/employees', 
jsonData: myParams, 
success: function(result, request){ 
... 

在服務器控制檯中,我看到傳遞的參數如下所示,這是錯誤的。

"employment_type"=>[false, true] 

我如何想有參數傳遞:

"employment_type"=>"documented" 

回答

2

使用form.getForm().getValues()代替form.getFieldValues()所示的位置:http://jsfiddle.net/chrisramakers/eL7qg/

但在另一方面,你爲什麼不提交通過調用form.getForm().submit()並讓Ext.form.BasicForm處理所有數據收集?

+0

這個工作的感謝,我設置裏面myParams其他一些參數,可以不使用Ext.form.BasicForm原因使用2個PARAMS時,有一個格式問題與JSON。 – 2011-03-15 09:57:53