Results 1 to 3 of 3

Thread: Get selected value in a radiogroup

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    Metz, France
    Posts
    60
    Vote Rating
    2
      0  

    Default Answered: Get selected value in a radiogroup

    Hello,

    I need to get the selected value of a radiogroup.

    My radiogroup :
    Code:
    var form = 
            {
                xtype: 'radiogroup',
                fieldLabel: 'Operator',
                id:'radiogroup',
                columns: 1,
                items: [
                    {boxLabel:'<', name:'operator', inputValue:'<'},
                    {boxLabel:'=', name:'operator', inputValue:'='},
                    {boxLabel:'>', name:'operator', inputValue:'>'}
                ]
            }
    I have try this :

    Code:
    Ext.getCmp('radiogroup').getValue()
    and

    Code:
    Ext.getCmp('radiogroup').getChecked()
    But it returns an array : [object Object].

    What's the problem?

    Thank you

  2. getValue and getChecked will do the same thing. It should return an object with the name of the radio and value...

    Code:
    {
        operator : '='
    }

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,357
    Answers
    3997
    Vote Rating
    1501
      0  

    Default

    getValue and getChecked will do the same thing. It should return an object with the name of the radio and value...

    Code:
    {
        operator : '='
    }
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    Metz, France
    Posts
    60
    Vote Rating
    2
      0  

    Default

    Ok I have found.

    Code:
    var radio = Ext.getCmp('radiogroup').getValue()
    radio is an object. I had to do just :

    Code:
    radio.operator
    And I get the inputValue.

    Very simple actually...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •