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' //input-group
42 type : this.inputType,
43 value : (!this.checked) ? this.valueOff : this.inputValue,
45 placeholder : this.placeholder || ''
54 input.checked = this.checked;
58 input.name = this.name;
62 input.cls += ' input-' + this.size;
66 ['xs','sm','md','lg'].map(function(size){
68 cfg.cls += ' col-' + size + '-' + settings[size];
72 var inputblock = input;
74 if (this.before || this.after) {
83 cls : 'input-group-addon',
87 inputblock.cn.push(input);
91 cls : 'input-group-addon',
98 if (align ==='left' && this.fieldLabel.length) {
99 Roo.log("left and has label");
105 cls : 'control-label col-md-' + this.labelWidth,
106 html : this.fieldLabel
110 cls : "col-md-" + (12 - this.labelWidth),
117 } else if ( this.fieldLabel.length) {
124 cls: 'control-label box-input-label',
125 //cls : 'input-group-addon',
126 html : this.fieldLabel
136 Roo.log(" no label && no align");
161 this.setChecked(true);
164 setChecked : function(state,suppressEvent)
167 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
168 v.dom.checked = false;
172 this.checked = state;
173 this.inputEl().dom.checked = state;
175 if(suppressEvent !== true){
176 this.fireEvent('check', this, state);
179 this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
183 getGroupValue : function()
186 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
187 if(v.dom.checked == true){
196 * Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see {@link #getRawValue}.
197 * @return {Mixed} value The field value
199 getValue : function(){
200 return this.getGroupValue();
203 setValue : function(v,suppressEvent)
205 this.setChecked(((typeof(v) == 'undefined') ? this.checked : (String(v) === String(this.inputValue))), suppressEvent);