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'>/**
19 </span> * A {@link Ext.form.FieldContainer field container} which has a specialized layout for arranging
20 * {@link Ext.form.field.Radio} controls into columns, and provides convenience {@link Ext.form.field.Field}
21 * methods for {@link #getValue getting}, {@link #setValue setting}, and {@link #validate validating} the
22 * group of radio buttons as a whole.
26 * Individual radio buttons themselves have no default validation behavior, but
27 * sometimes you want to require a user to select one of a group of radios. RadioGroup
28 * allows this by setting the config `{@link #allowBlank}:false`; when the user does not check at
29 * one of the radio buttons, the entire group will be highlighted as invalid and the
30 * {@link #blankText error message} will be displayed according to the {@link #msgTarget} config.</p>
34 * The default layout for RadioGroup makes it easy to arrange the radio buttons into
35 * columns; see the {@link #columns} and {@link #vertical} config documentation for details. You may also
36 * use a completely different layout by setting the {@link #layout} to one of the other supported layout
37 * types; for instance you may wish to use a custom arrangement of hbox and vbox containers. In that case
38 * the Radio components at any depth will still be managed by the RadioGroup's validation.
40 * {@img Ext.form.RadioGroup/Ext.form.RadioGroup.png Ext.form.RadioGroup component}
44 * Ext.create('Ext.form.Panel', {
45 * title: 'RadioGroup Example',
49 * renderTo: Ext.getBody(),
51 * xtype: 'radiogroup',
52 * fieldLabel: 'Two Columns',
53 * // Arrange radio buttons into two columns, distributed vertically
57 * {boxLabel: 'Item 1', name: 'rb', inputValue: '1'},
58 * {boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true},
59 * {boxLabel: 'Item 3', name: 'rb', inputValue: '3'},
60 * {boxLabel: 'Item 4', name: 'rb', inputValue: '4'},
61 * {boxLabel: 'Item 5', name: 'rb', inputValue: '5'},
62 * {boxLabel: 'Item 6', name: 'rb', inputValue: '6'}
68 Ext.define('Ext.form.RadioGroup', {
69 extend: 'Ext.form.CheckboxGroup',
70 alias: 'widget.radiogroup',
72 <span id='Ext-form-RadioGroup-cfg-items'> /**
73 </span> * @cfg {Array} items An Array of {@link Ext.form.field.Radio Radio}s or Radio config objects
74 * to arrange in the group.
76 <span id='Ext-form-RadioGroup-cfg-allowBlank'> /**
77 </span> * @cfg {Boolean} allowBlank True to allow every item in the group to be blank (defaults to true).
78 * If allowBlank = false and no items are selected at validation time, {@link #blankText} will
79 * be used as the error text.
82 <span id='Ext-form-RadioGroup-cfg-blankText'> /**
83 </span> * @cfg {String} blankText Error text to display if the {@link #allowBlank} validation fails
84 * (defaults to 'You must select one item in this group')
86 blankText : 'You must select one item in this group',
89 defaultType : 'radiofield',
92 groupCls : Ext.baseCSSPrefix + 'form-radio-group',
94 getBoxes: function() {
95 return this.query('[isRadio]');