PDA

View Full Version : problem with Radio getValue



srvrv12
30 May 2007, 10:04 AM
simple2.container( { width:450 });
var redRaa, redRab;
simple2.column({
width:125
},
redRaa = new Ext.form.Radio({
fieldLabel:"學費減免",
boxLabel :"無",
name: "haveReduce",
value: 0,
checked:true
})
);
simple2.column({
width:125
},
redRab = new Ext.form.Radio({
boxLabel :"有",
name: "haveReduce",
value: 1,
labelSeparator: ''
})
);
simple2.column({
width:250
},
new Ext.form.TextField({
//fieldLabel: '課程費用',
name: 'reduce',
id:'reduce',
width:80,
labelSeparator: ''
//allowBlank:false
//vtype:'alpha'
})
);
simple2.end(); //close container

redRaa.on('check', function(){
var reduce = simple2.findField('reduce');
reduce.disable();
reduce.setValue('');
redRaa.checked=true;
redRab.checked=false;
});
redRab.on('check', function(){
var reduce = simple2.findField('reduce');
reduce.enable();
redRaa.checked=false;
redRab.checked=true;
});

I use form.getValues() or


Ext.get('registForm').child('input[name=haveDiscount]:checked', true).value

I always get the radio value is "on", not the 0 or 1
can tell me why that??????~~~~thanks~~

jack.slocum
30 May 2007, 10:28 PM
The "value" for a radio or checkbox in Ext is a boolean. What you want to set is the "inputValue:1" for the underlying input element.

srvrv12
31 May 2007, 9:38 AM
thanks~~jack