PDA

View Full Version : Validate if any radio box is selected



Dumas
27 Jun 2010, 9:42 AM
Hi!

How can I have a validator which checks if a radi boy is selected?

Here's a quick example what i want to have:

var form = new Ext.form.FormPanel({
monitorValid: true,
title: 'How to validate that a radiobox is selected?',
renderTo: document.body,
items: [{
xtype : 'radiogroup',
defaults : {
xtype : 'radio',
name : name,
hideLabel : true
},
items: [{
boxLabel : "Yes",
inputValue: 1
}, {
boxLabel : "No",
inputValue: 0
}]
}],
buttons: [{
text: 'Should only be clickable if a radio box is selected',
handler: Ext.emptyFn,
formBind:true
}]
});

form.startMonitoring();

thx
Dumas

Dumas
27 Jun 2010, 11:31 AM
solved:
Add allowBlank: false to the radio group