Fixed autofill ignoring existing ID for text box parent node. (yes, again)
authorDan
Sat, 19 Jul 2008 21:01:57 -0400
changeset 647 6bb3d447b4b8
parent 646 55363ed1099e
child 648 082b7b47b859
Fixed autofill ignoring existing ID for text box parent node. (yes, again)
includes/clientside/static/autofill.js
--- a/includes/clientside/static/autofill.js	Sat Jul 19 20:47:17 2008 -0400
+++ b/includes/clientside/static/autofill.js	Sat Jul 19 21:01:57 2008 -0400
@@ -48,9 +48,6 @@
 
 function autofill_init_element(element, params)
 {
-  if ( element.parentNode.id.match(/^autofill_wrap_/) )
-    return false;
-  
   if ( !Spry.Data );
     load_spry_data();
   
@@ -112,12 +109,13 @@
       // inject our HTML wrapper
       var template = this.template.replace(new RegExp('--ID--', 'g'), element.id);
       var wrapper = element.parentNode; // document.createElement('div');
-      wrapper.id = 'autofill_wrap_' + element.id;
+      if ( !wrapper.id )
+        wrapper.id = 'autofill_wrap_' + element.id;
       
       // a bunch of hacks to add a spry wrapper
       wrapper.innerHTML = template + wrapper.innerHTML;
       
-      var autosuggest = new Spry.Widget.AutoSuggest("autofill_wrap_" + element.id, element.id + '_region', window.autofill_ds_username, 'name', {loadFromServer: true, urlParam: 'userinput', hoverSuggestClass: 'row2', minCharsType: 3});
+      var autosuggest = new Spry.Widget.AutoSuggest(wrapper.id, element.id + '_region', window.autofill_ds_username, 'name', {loadFromServer: true, urlParam: 'userinput', hoverSuggestClass: 'row2', minCharsType: 3});
       var regiondiv = document.getElementById(element.id + '_region');
       regiondiv.style.position = 'absolute';
       regiondiv.style.top = top + 'px';