web/data/cubicweb.ajax.box.js
changeset 6448 8590d82e9b1b
parent 6215 759cf097f5aa
child 6947 3d72028a6cd4
--- a/web/data/cubicweb.ajax.box.js	Mon Oct 11 17:46:22 2010 +0200
+++ b/web/data/cubicweb.ajax.box.js	Mon Oct 11 19:12:59 2010 +0200
@@ -53,28 +53,23 @@
         deferred.addCallback(function (unrelated) {
             var input = INPUT({'type': 'text', 'id': inputid, 'size': 20});
             holder.append(input).show();
-            $input = $(input);
-            $input.keypress(function (event) {
-                if (event.keyCode == KEYS.KEY_ENTER) {
-                    // XXX not very user friendly: we should test that the suggestions
-                    //     aren't visible anymore
+            var $input = $(input);
+            $input.keypress(function (evt) {
+                if (evt.keyCode == $.ui.keyCode.ENTER) {
                     ajaxBoxValidateSelectorInput(boxid, eid, separator, addfname, msg);
                 }
             });
+            $input.cwautocomplete(unrelated, {multiple: true});
             var buttons = DIV({'class' : "sgformbuttons"},
-                              A({'href' : "javascript: noop();",
-                                 'onclick' : cw.utils.strFuncCall('ajaxBoxValidateSelectorInput',
+                              A({href : "javascript: noop();",
+                                 onclick : cw.utils.strFuncCall('ajaxBoxValidateSelectorInput',
                                                                   boxid, eid, separator, addfname, msg)},
-                                  oklabel),
+                                oklabel),
                               ' / ',
                               A({'href' : "javascript: noop();",
                                  'onclick' : '$("#' + holderid + '").empty()'},
                                   cancellabel));
             holder.append(buttons);
-            $input.autocomplete(unrelated, {
-                multiple: separator,
-                max: 15
-            });
             $input.focus();
         });
     }