4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-form-RadioGroup-method-constructor'><span id='Ext-form-RadioGroup'>/**
19 </span></span> * @class Ext.form.RadioGroup
20 * @extends Ext.form.CheckboxGroup
21 * <p>A {@link Ext.form.FieldContainer field container} which has a specialized layout for arranging
22 * {@link Ext.form.field.Radio} controls into columns, and provides convenience {@link Ext.form.field.Field} methods
23 * for {@link #getValue getting}, {@link #setValue setting}, and {@link #validate validating} the group
24 * of radio buttons as a whole.</p>
25 * <p><b>Validation:</b> Individual radio buttons themselves have no default validation behavior, but
26 * sometimes you want to require a user to select one of a group of radios. RadioGroup
27 * allows this by setting the config <tt>{@link #allowBlank}:false</tt>; when the user does not check at
28 * one of the radio buttons, the entire group will be highlighted as invalid and the
29 * {@link #blankText error message} will be displayed according to the {@link #msgTarget} config.</p>
30 * <p><b>Layout:</b> The default layout for RadioGroup makes it easy to arrange the radio buttons into
31 * columns; see the {@link #columns} and {@link #vertical} config documentation for details. You may also
32 * use a completely different layout by setting the {@link #layout} to one of the other supported layout
33 * types; for instance you may wish to use a custom arrangement of hbox and vbox containers. In that case
34 * the Radio components at any depth will still be managed by the RadioGroup's validation.</p>
35 * <p>Example usage:</p>
36 * <pre><code>
37 var myRadioGroup = new Ext.form.RadioGroup({
40 fieldLabel: 'Single Column',
41 // Arrange radio buttons into three columns, distributed vertically
45 {boxLabel: 'Item 1', name: 'rb', inputValue: '1'},
46 {boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true},
47 {boxLabel: 'Item 3', name: 'rb', inputValue: '3'}
48 {boxLabel: 'Item 4', name: 'rb', inputValue: '4'}
49 {boxLabel: 'Item 5', name: 'rb', inputValue: '5'}
50 {boxLabel: 'Item 6', name: 'rb', inputValue: '6'}
53 * </code></pre>
55 * Creates a new RadioGroup
56 * @param {Object} config Configuration options
59 Ext.define('Ext.form.RadioGroup', {
60 extend: 'Ext.form.CheckboxGroup',
61 alias: 'widget.radiogroup',
63 <span id='Ext-form-RadioGroup-cfg-items'> /**
64 </span> * @cfg {Array} items An Array of {@link Ext.form.field.Radio Radio}s or Radio config objects
65 * to arrange in the group.
67 <span id='Ext-form-RadioGroup-cfg-allowBlank'> /**
68 </span> * @cfg {Boolean} allowBlank True to allow every item in the group to be blank (defaults to true).
69 * If allowBlank = false and no items are selected at validation time, {@link @blankText} will
70 * be used as the error text.
73 <span id='Ext-form-RadioGroup-cfg-blankText'> /**
74 </span> * @cfg {String} blankText Error text to display if the {@link #allowBlank} validation fails
75 * (defaults to 'You must select one item in this group')
77 blankText : 'You must select one item in this group',
80 defaultType : 'radiofield',
83 groupCls : Ext.baseCSSPrefix + 'form-radio-group',
85 getBoxes: function() {
86 return this.query('[isRadio]');