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',
62 var inline = this.inline ? 'radio-inline' : '';
66 // does not need for, as we wrap the input with it..
67 cls : 'control-label ' + inline,
74 cls : 'control-label' + inline,
75 html : this.fieldLabel
84 type : this.inputType,
85 //value : (!this.checked) ? this.valueOff : this.inputValue,
86 value : this.inputValue,
88 placeholder : this.placeholder || '' // ?? needed????
91 if (this.weight) { // Validity check?
92 input.cls += " radio-" + this.weight;
99 input.checked = this.checked;
103 input.name = this.name;
107 input.cls += ' input-' + this.size;
110 //?? can span's inline have a width??
113 ['xs','sm','md','lg'].map(function(size){
114 if (settings[size]) {
115 cfg.cls += ' col-' + size + '-' + settings[size];
119 var inputblock = input;
121 if (this.before || this.after) {
131 cls : 'input-group-addon',
135 inputblock.cn.push(input);
139 cls : 'input-group-addon',
147 if (this.fieldLabel && this.fieldLabel.length) {
148 cfg.cn.push(fieldLabel);
152 if (align ==='left' && this.fieldLabel.length) {
153 Roo.log("left and has label");
162 cls : 'radio-inline',
169 } else if ( this.fieldLabel.length) {
173 cfg.cn = [ lbl, inputblock ];
177 Roo.log(" no label && no align");
201 return this.el.select('input.roo-radio',true).first();
207 this.setChecked(true);
210 setChecked : function(state,suppressEvent)
213 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
214 v.dom.checked = false;
218 this.checked = state;
219 this.inputEl().dom.checked = state;
221 if(suppressEvent !== true){
222 this.fireEvent('check', this, state);
225 //this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
229 getGroupValue : function()
232 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
233 if(v.dom.checked == true){
242 * Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see {@link #getRawValue}.
243 * @return {Mixed} value The field value
245 getValue : function(){
246 return this.getGroupValue();