Author: sevein
Date: Sun Oct 17 06:22:26 2010
New Revision: 8190

Log:
Trigger change event only if autocomplete field is not multiple.

Modified:
   trunk/js/autocomplete.js

Modified: trunk/js/autocomplete.js
==============================================================================
--- trunk/js/autocomplete.js    Sun Oct 17 05:09:59 2010        (r8189)
+++ trunk/js/autocomplete.js    Sun Oct 17 06:22:26 2010        (r8190)
@@ -68,8 +68,21 @@
                     // http://dev.jquery.com/ticket/5163
                     var $hidden = $('<input name="' + $(this).attr('name') + 
'" type="hidden" value="' + ($(this).val() ? $(this).val() : '') + 
'"/>').insertAfter(this);
 
-                    // - and copy <option/> value to autocomplete <input/>
-                    $input.val($('option:selected', this).text());
+                    $input
+
+                      // Copy <option/> value to autocomplete <input/>
+                      .val($('option:selected', this).text())
+
+                      // 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('');
+                        }
+                      });
+
                   }
 
                   // A following sibling with class .list and a value specifies
@@ -147,17 +160,6 @@
                         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);
 

-- 
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