9 * @class Roo.bootstrap.Radio
10 * @extends Roo.bootstrap.CheckBox
11 * Bootstrap Radio class
15 * @param {Object} config The config object
18 Roo.bootstrap.Radio = function(config){
19 Roo.bootstrap.Radio.superclass.constructor.call(this, config);
23 Roo.extend(Roo.bootstrap.Radio, Roo.bootstrap.CheckBox, {
29 getAutoCreate : function()
31 var align = (!this.labelAlign) ? this.parentLabelAlign() : this.labelAlign;
37 cfg.cls = 'form-group radio' //input-group
40 cfg.cls += " radio-inline";
47 type : this.inputType,
48 //value : (!this.checked) ? this.valueOff : this.inputValue,
49 value : this.inputValue,
51 placeholder : this.placeholder || ''
54 if (this.weight) { // Validity check?
55 cfg.cls += " radio-" + this.weight;
62 input.checked = this.checked;
66 input.name = this.name;
70 input.cls += ' input-' + this.size;
74 ['xs','sm','md','lg'].map(function(size){
76 cfg.cls += ' col-' + size + '-' + settings[size];
80 var inputblock = input;
82 if (this.before || this.after) {
91 cls : 'input-group-addon',
95 inputblock.cn.push(input);
99 cls : 'input-group-addon',
109 cls : 'control-label col-md-' + this.labelWidth,
110 html : this.fieldLabel
119 if (align ==='left' && this.fieldLabel.length) {
120 Roo.log("left and has label");
128 cls : "col-md-" + (12 - this.labelWidth),
135 } else if ( this.fieldLabel.length) {
138 cfg.cn = [ lbl, inputblock ];
142 Roo.log(" no label && no align");
166 return this.el.select('input.roo-radio',true).first();
172 this.setChecked(true);
175 setChecked : function(state,suppressEvent)
178 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
179 v.dom.checked = false;
183 this.checked = state;
184 this.inputEl().dom.checked = state;
186 if(suppressEvent !== true){
187 this.fireEvent('check', this, state);
190 //this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
194 getGroupValue : function()
197 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
198 if(v.dom.checked == true){
207 * Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see {@link #getRawValue}.
208 * @return {Mixed} value The field value
210 getValue : function(){
211 return this.getGroupValue();