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;
32 align = align || 'left'; // default...
39 cfg.cls = 'form-group radio' //input-group
42 cfg.cls += " radio-inline";
49 type : this.inputType,
50 //value : (!this.checked) ? this.valueOff : this.inputValue,
51 value : this.inputValue,
53 placeholder : this.placeholder || ''
56 if (this.weight) { // Validity check?
57 cfg.cls += " radio-" + this.weight;
64 input.checked = this.checked;
68 input.name = this.name;
72 input.cls += ' input-' + this.size;
76 ['xs','sm','md','lg'].map(function(size){
78 cfg.cls += ' col-' + size + '-' + settings[size];
82 var inputblock = input;
84 if (this.before || this.after) {
93 cls : 'input-group-addon',
97 inputblock.cn.push(input);
101 cls : 'input-group-addon',
111 cls : 'control-label col-md-' + this.labelWidth,
112 html : this.fieldLabel
117 lbl.cls = 'col-md-' + this.labelWidth;
121 if (align ==='left' && this.fieldLabel.length) {
122 Roo.log("left and has label");
130 cls : "col-md-" + (12 - this.labelWidth), // very focused on md ???
137 } else if ( this.fieldLabel.length) {
140 cfg.cn = [ lbl, inputblock ];
144 Roo.log(" no label && no align");
168 return this.el.select('input.roo-radio',true).first();
174 this.setChecked(true);
177 setChecked : function(state,suppressEvent)
180 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
181 v.dom.checked = false;
185 this.checked = state;
186 this.inputEl().dom.checked = state;
188 if(suppressEvent !== true){
189 this.fireEvent('check', this, state);
192 //this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
196 getGroupValue : function()
199 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
200 if(v.dom.checked == true){
209 * Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see {@link #getRawValue}.
210 * @return {Mixed} value The field value
212 getValue : function(){
213 return this.getGroupValue();