10 <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
11 Option one is this and that—be sure to include why it's great
18 *<label class="radio-inline">fieldLabel</label>
19 *<label class="radio-inline">
20 <input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 1
28 * @class Roo.bootstrap.Radio
29 * @extends Roo.bootstrap.CheckBox
30 * Bootstrap Radio class
34 * @param {Object} config The config object
37 Roo.bootstrap.Radio = function(config){
38 Roo.bootstrap.Radio.superclass.constructor.call(this, config);
42 Roo.extend(Roo.bootstrap.Radio, Roo.bootstrap.CheckBox, {
48 getAutoCreate : function()
50 var align = (!this.labelAlign) ? this.parentLabelAlign() : this.labelAlign;
51 align = align || 'left'; // default...
58 tag : this.inline ? 'span' : 'div',
63 var inline = this.inline ? ' radio-inline' : '';
67 // does not need for, as we wrap the input with it..
69 cls : 'control-label box-label' + inline,
75 cls : 'control-label' + inline,
76 html : this.fieldLabel,
77 style : 'cursor:default'
86 type : this.inputType,
87 //value : (!this.checked) ? this.valueOff : this.inputValue,
88 value : this.inputValue,
90 placeholder : this.placeholder || '' // ?? needed????
93 if (this.weight) { // Validity check?
94 input.cls += " radio-" + this.weight;
101 input.checked = this.checked;
105 input.name = this.name;
109 input.cls += ' input-' + this.size;
112 //?? can span's inline have a width??
115 ['xs','sm','md','lg'].map(function(size){
116 if (settings[size]) {
117 cfg.cls += ' col-' + size + '-' + settings[size];
121 var inputblock = input;
123 if (this.before || this.after) {
133 cls : 'input-group-addon',
137 inputblock.cn.push(input);
141 cls : 'input-group-addon',
149 if (this.fieldLabel && this.fieldLabel.length) {
150 cfg.cn.push(fieldLabel);
153 lbl.cn.push(inputblock);
156 cls: 'radio' + inline,
174 initEvents : function()
176 // Roo.bootstrap.CheckBox.superclass.initEvents.call(this);
178 this.inputEl().on('click', this.onClick, this);
180 Roo.log('find label')
181 Roo.log(this.el.select('label.box-label',true).first());
182 this.el.select('label.box-label',true).first().on('click', this.onClick, this);
189 return this.el.select('input.roo-radio',true).first();
195 this.setChecked(true);
198 setChecked : function(state,suppressEvent)
201 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
202 v.dom.checked = false;
206 this.checked = state;
207 this.inputEl().dom.checked = state;
209 if(suppressEvent !== true){
210 this.fireEvent('check', this, state);
213 //this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
217 getGroupValue : function()
220 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
221 if(v.dom.checked == true){
230 * Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see {@link #getRawValue}.
231 * @return {Mixed} value The field value
233 getValue : function(){
234 return this.getGroupValue();