Ext RadioGroup - 如何访问所选单选按钮的值? [英] Ext RadioGroup - How to Access the value of selected radio button?

查看:147
本文介绍了Ext RadioGroup - 如何访问所选单选按钮的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在访问无线电组中所选单选按钮的值时遇到困难。我已经尝试了许多不同的方法,基于论坛和网络上其他帖子的讨论。不幸的是没有幸运(或熟练)足以让它工作。基于以下FormPanel配置,我希望有人能告诉我如何在mainPhone组中获取所选收音机的值。

I am having some difficulty accessing the value of the selected radio button in a radiogroup. I've attempted a number of different approaches based upon discussion in other posts on the forum and around the web. Unfortunately haven't been lucky (or skilled) enough to get it working. Based on the following FormPanel config I was hoping someone could show me how to get the value of the selected radio in the group 'mainPhone'.

谢谢!

想要更新以表明我能够从stackoverflow获得响应,而EXT-JS论坛没有提供任何帮助。方式去Stackoverflow!

Matt

function createForm(elem) {
var myForm2 = new Ext.form.FormPanel({
  renderTo:elem,
  width:425,
  frame:true,
  style:"margin: 10px auto 10px auto;",
  items: [{xtype:'fieldset',
            title: 'Contact Info',
            autoHeight:true,
            items :[new Ext.form.RadioGroup({
                        fieldLabel: 'Main Phone',
                        vertical: false,
                        id:"mainPhone",
                        items: [
                            {boxLabel: 'Home', name: 'id-1', inputValue: 'H', checked:true},
                            {boxLabel: 'Work', name: 'id-1', inputValue: 'W'},
                            {boxLabel: 'Other', name: 'id-1', inputValue: 'O'}
                        ]    

                    }),
                  new Ext.form.TextField({
                    id:"frm_CreateCustomerHomePhone",
                    fieldLabel:"Home Phone",
                    width:275,
                    allowBlank:true
                 }),
                 new Ext.form.TextField({
                    id:"frm_CreateCustomerWorkPhone",
                    fieldLabel:"Work Phone",
                    width:275,
                    allowBlank:true
                 })
                  new Ext.form.TextField({
                    id:"frm_CreateCustomerOtherPhone",
                    fieldLabel:"Other Phone",
                    width:275,
                    allowBlank:true
                 })
    ]}]});              
}


推荐答案

猜测,但是这样做如何:

This is something of a wild guess, but how about this:

myForm2.getForm().getValues()['id-1'];

这篇关于Ext RadioGroup - 如何访问所选单选按钮的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆