2011-03-15 63 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