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
42 type : this.inputType,
43 //value : (!this.checked) ? this.valueOff : this.inputValue,
44 value : this.inputValue,
46 placeholder : this.placeholder || ''
49 if (this.weight) { // Validity check?
50 cfg.cls += " radio-" + this.weight;
57 input.checked = this.checked;
61 input.name = this.name;
65 input.cls += ' input-' + this.size;
69 ['xs','sm','md','lg'].map(function(size){
71 cfg.cls += ' col-' + size + '-' + settings[size];
75 var inputblock = input;
77 if (this.before || this.after) {
86 cls : 'input-group-addon',
90 inputblock.cn.push(input);
94 cls : 'input-group-addon',
101 if (align ==='left' && this.fieldLabel.length) {
102 Roo.log("left and has label");
108 cls : 'control-label col-md-' + this.labelWidth,
109 html : this.fieldLabel
113 cls : "col-md-" + (12 - this.labelWidth),
120 } else if ( this.fieldLabel.length) {
127 cls: 'control-label box-input-label',
128 //cls : 'input-group-addon',
129 html : this.fieldLabel
139 Roo.log(" no label && no align");
163 return this.el.select('input.roo-radio',true).first();
167 this.setChecked(true);
170 setChecked : function(state,suppressEvent)
173 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
174 v.dom.checked = false;
178 this.checked = state;
179 this.inputEl().dom.checked = state;
181 if(suppressEvent !== true){
182 this.fireEvent('check', this, state);
185 this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
189 getGroupValue : function()
192 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
193 if(v.dom.checked == true){
202 * Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see {@link #getRawValue}.
203 * @return {Mixed} value The field value
205 getValue : function(){
206 return this.getGroupValue();