Ticket #9882: patch_for_autocompleter_parameters.diff
| File patch_for_autocompleter_parameters.diff, 3.2 kB (added by xutopia, 9 months ago) |
|---|
-
test/functional/ajax_autocompleter_test.html
old new 26 26 27 27 <br/> 28 28 29 Autocompleter ac2 w/ parameters : <input id="ac2" type="text" name="ac2"/>29 Autocompleter ac2 w/ parameters as a string: <input id="ac2" type="text" name="ac2"/> 30 30 <div id="ac2update" style="display:none;border:1px solid black;background-color:white;"></div> 31 31 32 32 … … 38 38 39 39 <br/> 40 40 41 Autocompleter ac3 (nested in postion:relative div, selects "selectme" class): 41 Autocompleter ac3 w/ parameters as a hash: <input id="ac3" type="text" name="ac3"/> 42 <div id="ac3update" style="display:none;border:1px solid black;background-color:white;"></div> 43 44 <script type="text/javascript" language="javascript" charset="utf-8"> 45 // <![CDATA[ 46 new Ajax.Autocompleter('ac3','ac3update','_autocomplete_result.html',{parameters:{a: 'b', b: 'c'}}); 47 // ]]> 48 </script> 49 50 <br/> 51 52 Autocompleter ac4 (nested in postion:relative div, selects "selectme" class): 42 53 <br/> 43 54 <div style="position:relative"> 44 <input id="ac 3" type="text"/>45 <div id="ac 3update" style="display:none;border:1px solid black;background-color:white;"></div>55 <input id="ac4" type="text"/> 56 <div id="ac4update" style="display:none;border:1px solid black;background-color:white;"></div> 46 57 </div> 47 58 48 59 <script type="text/javascript" language="javascript" charset="utf-8"> 49 60 // <![CDATA[ 50 new Ajax.Autocompleter('ac 3','ac3update','_autocomplete_result.html',{select:'selectme'});61 new Ajax.Autocompleter('ac4','ac4update','_autocomplete_result.html',{select:'selectme'}); 51 62 // ]]> 52 63 </script> 53 64 54 65 <br/><select><option>First Item</option><option>Second Item</option><option>Third Item</option></select> 55 66 56 67 <br/><br/> 57 Autocompleter ac 4(autoselects option if single single option is returned):68 Autocompleter ac5 (autoselects option if single single option is returned): 58 69 <br/> 59 <input id="ac 4" type="text"/>60 <div id="ac 4update" style="display:none;border:1px solid black;background-color:white;"></div>70 <input id="ac5" type="text"/> 71 <div id="ac5update" style="display:none;border:1px solid black;background-color:white;"></div> 61 72 62 73 <script type="text/javascript" language="javascript" charset="utf-8"> 63 74 // <![CDATA[ 64 new Ajax.Autocompleter('ac 4','ac4update','_autocomplete_result_single.html',{select:'selectme',autoSelect:true});75 new Ajax.Autocompleter('ac5','ac5update','_autocomplete_result_single.html',{select:'selectme',autoSelect:true}); 65 76 // ]]> 66 77 </script> 67 78 -
src/controls.js
old new 360 360 this.options.parameters = this.options.callback ? 361 361 this.options.callback(this.element, entry) : entry; 362 362 363 if(this.options.defaultParams) 364 this.options.parameters += '&' + this.options.defaultParams; 365 363 if(this.options.defaultParams){ 364 this.options.parameters += '&' 365 + (typeof this.options.defaultParams == 'string' ? 366 this.options.defaultParams : 367 $H(this.options.defaultParams).toQueryString()) 368 } 366 369 new Ajax.Request(this.url, this.options); 367 370 }, 368 371