ACQ unified search submit on enter (for real)
authorBill Erickson <berick@esilibrary.com>
Wed, 1 Aug 2012 17:54:00 +0000 (13:54 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 1 Aug 2012 18:23:29 +0000 (14:23 -0400)
This replaces the old-style submit on enter handler which was based
attaching key handlers to the dijit domNode, which does not work for
filtering selects (i.e. more complicated dijits) w/ the dijit-sanctioned
dojo.connect(..., 'onkeyup', ...), which works regardless.  This also
covers more form input elements which were overlooked with the original
submit-on-enter code.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>

Open-ILS/web/js/ui/default/acq/search/unified.js

index 2c1eff0..6f6142f 100644 (file)
@@ -165,6 +165,16 @@ function TermSelectorFactory(terms) {
                     wStore[widgetKey].focus();
                 if (typeof(callback) == "function")
                     callback(term, widgetKey);
+
+                // submit on enter
+                dojo.connect(wStore[widgetKey], 'onkeyup',
+                    function(e) {
+                        if(e.keyCode == dojo.keys.ENTER) {
+                            resultManager.go(termManager.buildSearchObject());
+                        }
+                    }
+                );
+
             } else {
                 new openils.widget.AutoFieldWidget({
                     "fmClass": term.hint,
@@ -186,9 +196,11 @@ function TermSelectorFactory(terms) {
                             callback(term, widgetKey);
 
                         // submit on enter
-                        openils.Util.registerEnterHandler(w.domNode,
-                            function() { 
-                                resultManager.go(termManager.buildSearchObject());
+                        dojo.connect(w.domNode, 'onkeyup',
+                            function(e) {
+                                if(e.keyCode == dojo.keys.ENTER) {
+                                    resultManager.go(termManager.buildSearchObject());
+                                }
                             }
                         );
                     }