初学ext的问题

mirzlm 2009-04-08 11:02:06
在使用ext的过程中,遇到了一个问题,就是在提交ext表单的时候,后台不能取到单选按钮的值 取到的都是string型的字符串 "on" 后台的名字与ext里的是对牢的,不然 on 都取不到,是null

现在想问一下,应该怎么取单选按钮的值呢

还有,ext里是怎么取对象的值的


var form=new Ext.FormPanel({
items:[{
xtype:'panel',
fieldLabel:'密    级',
name:'securitylevel',
isFormField:true,
items : [{
xtype:'radio',
name : 'security',
boxLabel:'机密',
value:'机密'
},{
xtype:'radio',
name : 'security',
boxLabel:'秘密',
value:'秘密'
},{
xtype:'radio',
name : 'security',
boxLabel:'内部资料',
value:'内部资料',
checked :true
}]
}]

我应该怎么取到上面的单选按钮的值 在ext中
...全文
149 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ghost_520 2009-04-09
  • 打赏
  • 举报
回复

常理上说 ext 在同一个页面不能允许多个相同 id 的值出现的,不然只会显示一个,像 radio 这里直接用 name 就可以了,在后台取值时可以使用

request.getParamter("security"); 就可以得到想对应的值。还有关于 inputValue 和 value 两个属性对应的说明楼主还需要多看看 api 啊。

诸如此类的还有 checkbox ,combobox 都差不多是这样的。
Ghost_520 2009-04-09
  • 打赏
  • 举报
回复

来晚了,问题解决没?
mirzlm 2009-04-09
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 Ghost_520 的回复:]

常理上说 ext 在同一个页面不能允许多个相同 id 的值出现的,不然只会显示一个,像 radio 这里直接用 name 就可以了,在后台取值时可以使用

request.getParamter("security"); 就可以得到想对应的值。还有关于 inputValue 和 value 两个属性对应的说明楼主还需要多看看 api 啊。

诸如此类的还有 checkbox ,combobox 都差不多是这样的。
[/Quote]

呵呵,不太会看api 后来是我们项目老大,帮我解决的
mumu_java 2009-04-08
  • 打赏
  • 举报
回复
lz知道radio的个数,id可以取成不同的值。不过这样得到radio的值后好要手动传到后台,ext应该可以得到radio的值,lz把三个radio的name换成不同的值试试。
mirzlm 2009-04-08
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 netharry 的回复:]
最好加一个id
比如: xtype:'radio',
id:'security',
name : 'security',
boxLabel:'内部资料',
value:'内部资料',
checked :true

var isSecurity=form.getComponent('security').getValue();
[/Quote]
好的,我去试试,不过,新的问题又来了,三个ID都一样,不会报错吗
netharry 2009-04-08
  • 打赏
  • 举报
回复
最好加一个id
比如: xtype:'radio',
id:'security',
name : 'security',
boxLabel:'内部资料',
value:'内部资料',
checked :true

var isSecurity=form.getComponent('security').getValue();
mirzlm 2009-04-08
  • 打赏
  • 举报
回复
原来还需要定义inputValue 不然不能取到

var form=new Ext.FormPanel({
items:[{
xtype:'panel',
fieldLabel:'密    级',
name:'securitylevel',
isFormField:true,
items : [{
xtype:'radio',
name : 'security',
boxLabel:'机密',
inputValue :'机密'
},{
xtype:'radio',
name : 'security',
boxLabel:'秘密',
inputValue :'秘密'
},{
xtype:'radio',
name : 'security',
boxLabel:'内部资料',
inputValue :'内部资料',
checked :true
}]
}]

mirzlm 2009-04-08
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 mumu_java 的回复:]
lz知道radio的个数,id可以取成不同的值。不过这样得到radio的值后好要手动传到后台,ext应该可以得到radio的值,lz把三个radio的name换成不同的值试试。
[/Quote]

名字不一样,就不能组成一组radio了 ,我现在也在试手动取得radio选中的那个值,再传入后台,可我不会哎,我不会ext得radio的值

who help me
mirzlm 2009-04-08
  • 打赏
  • 举报
回复
天啊,为什么没人来回答哎 应该不难吧。。。

52,782

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧