Author: sevein
Date: Fri Oct  8 17:03:19 2010
New Revision: 8028

Log:
Check $input length eache time "change" event is triggered to check value 
length and to empty $hidden value attribute if necessary. Fixes issue 1685.

Modified:
   trunk/js/autocomplete.js

Modified: trunk/js/autocomplete.js
==============================================================================
--- trunk/js/autocomplete.js    Fri Oct  8 00:02:51 2010        (r8027)
+++ trunk/js/autocomplete.js    Fri Oct  8 17:03:19 2010        (r8028)
@@ -146,7 +146,18 @@
                         // unmatched item select custom YUI events
                         autoComplete._onTextboxBlur(event, autoComplete);
                       }
+                    })
+                    
+                  // Give user chance to remove a selection, in case the text
+                  // field is completely removed, hidden value is cleared.
+                  .change(function ()
+                    {
+                      if (0 == $input.val().length)
+                      {
+                        $hidden.val('');
+                      }
                     });
+                    
 
                   var autoComplete = new YAHOO.widget.AutoComplete($input[0], 
$('<div/>').insertAfter(this)[0], dataSource);
 
@@ -159,16 +170,6 @@
                   // http://developer.yahoo.com/yui/autocomplete/#delay
                   autoComplete.queryDelay = 1;
 
-                  // Give user chance to remove a selection, in case the text
-                  // field is completely removed, hidden value is cleared.
-                  autoComplete.textboxKeyEvent.subscribe(function ()
-                    {
-                      if (0 == $input.val().length)
-                      {
-                        $hidden.val('');
-                      }
-                    }); 
-
                   // Alternatively use try/catch?
                   if ('undefined' !== typeof dataSource.liveData.indexOf
                     && -1 != dataSource.liveData.indexOf('?'))

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to