From 460d34e561fbeb9e9c878fb2f7faa45b260ee9a3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 1 Aug 2012 13:54:00 -0400 Subject: [PATCH] ACQ unified search submit on enter (for real) 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 Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/web/js/ui/default/acq/search/unified.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/search/unified.js b/Open-ILS/web/js/ui/default/acq/search/unified.js index 2c1eff01bc..6f6142fbc9 100644 --- a/Open-ILS/web/js/ui/default/acq/search/unified.js +++ b/Open-ILS/web/js/ui/default/acq/search/unified.js @@ -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()); + } } ); } -- 2.11.0