Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ext RadioGroup - How to Access the value of selected radio button?

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'.

Thanks!

Wanted to update to indicate that I was able to get a response from stackoverflow while the EXT-JS forums didn't provide me with any help. Way to go 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
                 })
    ]}]});              
}
like image 380
Matty Avatar asked Jan 05 '09 21:01

Matty


1 Answers

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

myForm2.getForm().getValues()['id-1'];
like image 171
Adam Bellaire Avatar answered Sep 23 '22 07:09

Adam Bellaire