roojs-ui.js
[roojs1] / Roo / form / Radio.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11  
12 /**
13  * @class Roo.form.Radio
14  * @extends Roo.form.Checkbox
15  * Single radio field.  Same as Checkbox, but provided as a convenience for automatically setting the input type.
16  * Radio grouping is handled automatically by the browser if you give each radio in a group the same name.
17  * @constructor
18  * Creates a new Radio
19  * @param {Object} config Configuration options
20  */
21 Roo.form.Radio = function(){
22     Roo.form.Radio.superclass.constructor.apply(this, arguments);
23 };
24 Roo.extend(Roo.form.Radio, Roo.form.Checkbox, {
25     inputType: 'radio',
26
27     /**
28      * If this radio is part of a group, it will return the selected value
29      * @return {String}
30      */
31     getGroupValue : function(){
32         return this.el.up('form').child('input[name='+this.el.dom.name+']:checked', true).value;
33     }
34 });