View Full Version : Ext.form.Radio has no 'value' config but setValue()!

13 Sep 2008, 3:09 AM
Hi People
The Ext.form.Radio->setValue method claims it goes looking for a Radio of same name and given value (if parameter passed is a String). However, there is no 'value' config property - at least not documented. And setValue doesn't work as it claims. Here is a simple test case:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="http://extjs.com/deploy/dev/resources/css/ext-all.css" />
<script type="text/javascript" src="http://extjs.com/deploy/dev/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://extjs.com/deploy/dev/ext-all.js"></script>
.link { text-decoration: underline; cursor:pointer}
<script type='text/javascript'>
function on_ready() {
for(var i=0; i < 3; i++) {
var r = new Ext.form.Radio({
id: 'radio-'+i,
value: String(10+i),
renderTo: 'my-div'
Ext.getCmp('radio-1').setValue('11'); // <-- This doesn't check any radio. It Should!
<div id='my-div'></div>
So, what's a way to assign a value to a radio so later I can do setValue(<value-assigned>) and this'll cause the radio to get checked?

13 Sep 2008, 3:29 AM
you should use inputValue instead of value.

13 Sep 2008, 3:31 AM
*Sigh* .. yet another extjs 'gotcha'...Principle of least surprise would suggest having a 'value' config property.
But inputValue is what I was looking for so thanks for your reply.

13 Sep 2008, 3:32 AM
:P it sometimes gets the best of us dude ;)