Ticket #5974: 5974.2.patch
| File 5974.2.patch, 3.1 kB (added by haysmark, 8 months ago) |
|---|
-
form/ComboBox.js
1064 1064 // summary: 1065 1065 // See dojo.data.util.simpleFetch.fetch() 1066 1066 if(!args.query){ args.query = {}; } 1067 if(!args.query.name){ args.query.name = " *"; }1067 if(!args.query.name){ args.query.name = ""; } 1068 1068 if(!args.queryOptions){ args.queryOptions = {}; } 1069 1069 var query = "^" + args.query.name 1070 1070 .replace(/([\\\|\(\)\[\{\^\$\+\?\.\<\>])/g, "\\$1") -
form/FilteringSelect.js
29 29 // 30 30 _isvalid:true, 31 31 32 required:true, 33 32 34 _lastDisplayedValue: "", 33 35 34 36 isValid:function(){ 35 return this._isvalid ;37 return this._isvalid||(!this.required&&this.getDisplayedValue()==""); // #5974 36 38 }, 37 39 38 40 _callbackSetLabel: function( /*Array*/ result, … … 74 76 75 77 getValue:function(){ 76 78 // don't get the textbox value but rather the previously set hidden value 77 return this. valueNode.value;79 return this.isValid()?this.valueNode.value:undefined; 78 80 }, 79 81 80 82 _getValueField:function(){ … … 95 97 // Sets the value of the select. 96 98 // Also sets the label to the corresponding value by reverse lookup. 97 99 100 // #5974: setValue(undefined) should clear input 101 if(value==undefined){ 102 this.setDisplayedValue("",priorityChange); 103 return; 104 } 105 98 106 //#3347: fetchItemByIdentity if no keyAttr specified 99 107 var self=this; 100 108 var handleFetchByIdentity = function(item, priorityChange){ -
tests/form/test_FilteringSelect.html
68 68 <hr> 69 69 70 70 <form action="#" method="GET"> 71 <p>FilteringSelect #1: inlined data, autoComplete=false :</p>71 <p>FilteringSelect #1: inlined data, autoComplete=false, required=false:</p> 72 72 <label for="setvaluetest2">state list 1:</label> 73 73 <select dojoType="dijit.form.FilteringSelect" 74 74 id="setvaluetest2" 75 75 name="state1" 76 76 autoComplete="false" 77 required="false" 77 78 invalidMessage="Invalid state name" 78 79 onChange="dojo.byId('oc1').value=arguments[0]" 79 80 onFocus="console.log('user focus handler')" 80 81 onBlur="console.log('user blur handler')" 81 82 > 82 <option value="blank"></option>83 83 <option value="AL">Alabama</option> 84 84 <option value="AK">Alaska</option> 85 85 <option value="AS">American Samoa</option> … … 163 163 > 164 164 <span>Value: <input id="value2" disabled></span> 165 165 166 <p>FilteringSelect #3: url, autoComplete=false :</p>166 <p>FilteringSelect #3: url, autoComplete=false, required=false:</p> 167 167 <label for="state3">state list 3:</label> 168 168 <input searchAttr="name" 169 169 id="state3" … … 172 172 store="stateStore" 173 173 name="state3" 174 174 autoComplete="false" 175 required="false" 175 176 onChange="setValue('value3', arguments[0]);" 176 177 invalidMessage="Invalid state name." 177 178 >