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,
73 cls : 'control-label' + inline,
74 html : this.fieldLabel
83 type : this.inputType,
84 //value : (!this.checked) ? this.valueOff : this.inputValue,
85 value : this.inputValue,
87 placeholder : this.placeholder || '' // ?? needed????
90 if (this.weight) { // Validity check?
91 input.cls += " radio-" + this.weight;
98 input.checked = this.checked;
102 input.name = this.name;
106 input.cls += ' input-' + this.size;
109 //?? can span's inline have a width??
112 ['xs','sm','md','lg'].map(function(size){
113 if (settings[size]) {
114 cfg.cls += ' col-' + size + '-' + settings[size];
118 var inputblock = input;
120 if (this.before || this.after) {
130 cls : 'input-group-addon',
134 inputblock.cn.push(input);
138 cls : 'input-group-addon',
146 if (this.fieldLabel && this.fieldLabel.length) {
147 cfg.cn.push(fieldLabel);
151 if (align ==='left' && this.fieldLabel.length) {
152 Roo.log("left and has label");
161 cls : 'radio-inline',
168 } else if ( this.fieldLabel.length) {
172 cfg.cn = [ lbl, inputblock ];
176 Roo.log(" no label && no align");
200 return this.el.select('input.roo-radio',true).first();
206 this.setChecked(true);
209 setChecked : function(state,suppressEvent)
212 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
213 v.dom.checked = false;
217 this.checked = state;
218 this.inputEl().dom.checked = state;
220 if(suppressEvent !== true){
221 this.fireEvent('check', this, state);
224 //this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
228 getGroupValue : function()
231 Roo.each(this.inputEl().up('form').select('input[name='+this.inputEl().dom.name+']', true).elements, function(v){
232 if(v.dom.checked == true){
241 * Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see {@link #getRawValue}.
242 * @return {Mixed} value The field value
244 getValue : function(){
245 return this.getGroupValue();