View Full Version : Help with Radio groups

21 Aug 2007, 2:20 AM
Ok here is my radio group

var StatusBoth = new Ext.form.Radio({
boxLabel: 'Both',
checked: true,
id: 'StatusBoth',
name: 'dueStatus'

var StatusDue = new Ext.form.Radio({
boxLabel: 'Due Only',
id: 'StatusDue',
name: 'dueStatus'

var StatusOverdue = new Ext.form.Radio({
boxLabel: 'Overdue Only',
id: 'StatusOverdue',
name: 'dueStatus'

So reading the docs I see I can use getGroupValue() to see which radio is selected


What do I put inplace of the the **** to get the getGroupValue to work?

Hers is my current [non-working] code to get the selected radio

ds.baseParams = {

The just returns

Filter on

not the actual name/value of the radio selected

21 Aug 2007, 9:16 AM
Sorry to bump but i've simplified the example code above to hopefully make it easier to understand

26 Aug 2007, 6:54 AM
I have the same problem. /:)

loginSuccess = function(form, action) {


hideLabels: true,
width: 360
rememberme = new Ext.form.Radio({
boxLabel: 'Save my username',
name: 'rememberme',
inputValue: 'username',
checked: remembermeUsername
new Ext.form.Radio({
boxLabel: 'Save my username and password',
name: 'rememberme',
inputValue: 'both',
checked: remembermeBoth
new Ext.form.Radio({
boxLabel: 'Automatic login',
name: 'rememberme',
inputValue: 'auto',
checked: remembermeAuto

It always promts "username", no matter what radio was checked during login.

26 Aug 2007, 7:23 AM
Your code looks fine. Have you tried adding a debugger; statement in FireBug and actually checking the state of the radio at that point?

26 Aug 2007, 7:35 AM
No, but you made me try something else.

I used this earlier to set the initial value:

var remembermeUsername = true;
var remembermeBoth = false;
var remembermeAuto = false;

But now I changed it to:

var remembermeUsername = false;
var remembermeBoth = true;
var remembermeAuto = false;

And now the alert says "Both". So you were right, the radios arnt actually checked when I check them. What might this be... :-?

26 Aug 2007, 7:54 AM
Sigh...ok..solved it.

This is what caused the problem:

reset: true,
success: loginSuccess,
failure: loginFailure

Thanks for the help Jack. \:D/

26 Aug 2007, 8:00 AM
Speaking of radios, in IE6 and 7, not FF, the radios are moved about 5 pixels to the right when checked. And then they stay there when unchecked. ~o)

Havnt seen any other reports of this. So weird..

29 Aug 2007, 12:17 AM
Speaking of radios, in IE6 and 7, not FF, the radios are moved about 5 pixels to the right when checked. And then they stay there when unchecked. ~o)

Havnt seen any other reports of this. So weird..

This has been reported here (http://extjs.com/forum/showthread.php?t=9086&highlight=radio) and a fix is posted on page two. Its a bit of a pain if you quite a few radios and checkboxes. hope 1.1.1 comes out soon

12 Sep 2007, 10:34 AM
I'm also having trouble with this.

var c1 = new Ext.form.Radio({
fieldLabel: 'Correct',

var c2 = new Ext.form.Radio({
fieldLabel: 'Correct',

I have a series of these, meant to specify which answer is the correct one in multiple choice quiz question form.

Based on the docs, I would expect that if I selected, say, the 3rd one and then used c6.getGroupValue() (or c2.getGroupValue()...any member of the group), the return would be "c3". Instead, the return is simply "on".

What am I missing?


12 Sep 2007, 11:27 AM
Futher experimentation shows that, using the fields in my previous post,

console.log('c1', c1.getValue());
console.log('c1', c1.getRawValue());
console.log('c2', c2.getValue());
console.log('c2', c2.getRawValue());

Will output

c1 false
c1 on
c2 false
c2 on

Which indicates that the get[Raw]Value() functions don't actually return the value, just the state. So is there any way to get the actual value assigned to a radio button, not to mention the selected value of a group?

26 Oct 2007, 8:33 AM
I have a similar issue while using getGroupValue() on radio button group. First I am getting the radio element and then calling the getGroupValue() function: Ext.get('radio').getGroupValue(); I get the error: "getGroupValue is not a function". However I can apply other public methods like: Ext.get('radio').hide(); and hide works like a charm. What I am doing wrong on getGroupValue?

31 Oct 2007, 8:00 AM
I found the solution for this: http://extjs.com/forum/showthread.php?t=16573

5 Nov 2007, 9:19 AM
Hi all,
why don't you put the radio group inside a form?
In this case, you can write:




30 Dec 2007, 6:40 PM
I have the following code:


<input type="radio" id="sameAddress" value="Y"><br>
<input type="radio" id="diffAddress" value="N"><br>

Ext.test.widgets.push({init : function() {
this.component = new Ext.form.Radio({
boxLabel: 'Same as applicant Address',
name: 'GROUPNAME',
inputValue:'Y' ,
this.component = new Ext.form.Radio({
boxLabel: 'Not the same (Please provide details below)',
name: 'GROUPNAME',
inputValue:'N' ,

I am able to show the radio buttons but unable to click on the button??
Any idea why??

Thanks in adv.

21 Nov 2008, 11:48 AM

25 Mar 2009, 3:16 AM
thanks so much for this, guys. you are my life-savers. =)