30 window[ds_name] = new Spry.Data.JSONDataSet(makeUrlNS('Special', 'Autofill', 'type=' + fillclass + '&allow_anon' + allow_anon)); |
30 window[ds_name] = new Spry.Data.JSONDataSet(makeUrlNS('Special', 'Autofill', 'type=' + fillclass + '&allow_anon' + allow_anon)); |
31 |
31 |
32 // inject our HTML wrapper |
32 // inject our HTML wrapper |
33 var template = this.template.replace(new RegExp('--ID--', 'g'), element.id).replace(new RegExp('--CLASS--', 'g', fillclass)); |
33 var template = this.template.replace(new RegExp('--ID--', 'g'), element.id).replace(new RegExp('--CLASS--', 'g', fillclass)); |
34 var wrapper = element.parentNode; // document.createElement('div'); |
34 var wrapper = element.parentNode; // document.createElement('div'); |
35 wrapper.id = 'autofill_wrap_' + element.id; |
35 if ( !wrapper.id ) |
|
36 wrapper.id = 'autofill_wrap_' + element.id; |
36 |
37 |
37 // a bunch of hacks to add a spry wrapper |
38 // a bunch of hacks to add a spry wrapper |
38 wrapper.innerHTML = template + wrapper.innerHTML; |
39 wrapper.innerHTML = template + wrapper.innerHTML; |
39 |
40 |
40 var autosuggest = new Spry.Widget.AutoSuggest("autofill_wrap_" + element.id, element.id + '_region', window[ds_name], 'name', {loadFromServer: true, urlParam: 'userinput', hoverSuggestClass: 'row2', minCharsType: 3}); |
41 var autosuggest = new Spry.Widget.AutoSuggest(wrapper.id, element.id + '_region', window[ds_name], 'name', {loadFromServer: true, urlParam: 'userinput', hoverSuggestClass: 'row2', minCharsType: 3}); |
41 var regiondiv = document.getElementById(element.id + '_region'); |
42 var regiondiv = document.getElementById(element.id + '_region'); |
42 regiondiv.style.position = 'absolute'; |
43 regiondiv.style.position = 'absolute'; |
43 regiondiv.style.top = top + 'px'; |
44 regiondiv.style.top = top + 'px'; |
44 regiondiv.style.left = left + 'px'; |
45 regiondiv.style.left = left + 'px'; |
45 } |
46 } |