Changeset 12183
- Timestamp:
- 01/28/08 01:01:39 (7 months ago)
- Files:
-
- 2 modified
-
dijit/trunk/form/Form.js (modified) (2 diffs)
-
dojox/trunk/widget/tests/test_FormWidgets.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/Form.js
r12067 r12183 49 49 w.setAttribute('checked', (dojo.indexOf(values, w.value) != -1)); 50 50 }); 51 }else if(widgets[0].setValues){ 52 // it's a multi-select 53 widgets[0].setValues(values); 51 54 }else{ 52 55 // otherwise, values is a list of values to be assigned sequentially to each widget … … 135 138 var obj = { }; 136 139 dojo.forEach(this.getDescendants(), function(widget){ 137 var value = (widget.getValue && !widget._getValueDeprecated) ? widget.getValue() : widget.value;138 140 var name = widget.name; 139 141 if(!name){ return; } 140 142 141 // Store widget's value(s) as a scalar, except for checkboxes which are automatically arrays 142 if(typeof widget.checked == 'boolean'){ 143 if(/Radio/.test(widget.declaredClass)){ 144 // radio button 145 if(widget.checked){ 146 dojo.setObject(name, value, obj); 143 if(widget.getValues){ 144 // A multi-value widget (ex: MultiSelect) 145 dojo.setObject(name, widget.getValues(), obj); 146 }else{ 147 // Single value widget (checkbox, radio, or plain <input> type widget 148 var value = (widget.getValue && !widget._getValueDeprecated) ? widget.getValue() : widget.value; 149 150 // Store widget's value(s) as a scalar, except for checkboxes which are automatically arrays 151 if(typeof widget.checked == 'boolean'){ 152 if(/Radio/.test(widget.declaredClass)){ 153 // radio button 154 if(widget.checked){ 155 dojo.setObject(name, value, obj); 156 } 157 }else{ 158 // checkbox/toggle button 159 var ary=dojo.getObject(name, false, obj); 160 if(!ary){ 161 ary=[]; 162 dojo.setObject(name, ary, obj); 163 } 164 if(widget.checked){ 165 ary.push(value); 166 } 147 167 } 148 168 }else{ 149 // checkbox/toggle button 150 var ary=dojo.getObject(name, false, obj); 151 if(!ary){ 152 ary=[]; 153 dojo.setObject(name, ary, obj); 154 } 155 if(widget.checked){ 156 ary.push(value); 157 } 158 } 159 }else{ 160 // plain input 161 dojo.setObject(name, value, obj); 169 // plain input 170 dojo.setObject(name, value, obj); 171 } 162 172 } 163 173 }); -
dojox/trunk/widget/tests/test_FormWidgets.html
r12143 r12183 3 3 <html> 4 4 <head> 5 <title>Testing degrad able form widgets | The Dojo Toolkit</title>5 <title>Testing degradeable form widgets | The Dojo Toolkit</title> 6 6 7 7 <link rel="stylesheet" type="text/css" media="screen" … … 232 232 console.log('getting values from split:'); 233 233 dojo.query("#splitC > select").forEach(function(n){ 234 // dump tthe select's name attrib, and the value(s) selected:234 // dump the select's name attrib, and the value(s) selected: 235 235 console.log(n.name,dijit.byNode(n).getValue()); 236 236 });