From 18f3d46ca8bfb4b122e14535a5dddea059a18e5a Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 5 Apr 2012 22:57:38 +0000 Subject: [PATCH] Bind enter key to start a search, skipping minimum character limit --- etemplate/js/et2_widget_link.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/etemplate/js/et2_widget_link.js b/etemplate/js/et2_widget_link.js index 479123a314..ea394bb639 100644 --- a/etemplate/js/et2_widget_link.js +++ b/etemplate/js/et2_widget_link.js @@ -402,6 +402,17 @@ var et2_link_entry = et2_inputWidget.extend({ disabled: self.options.disabled }); + // Bind to enter key to start search early + this.search.keydown(function(e) { + var keycode = (e.keyCode ? e.keyCode : e.which); + if(keycode == '13') + { + self.search.autocomplete("option","minLength", 0); + self.search.autocomplete("search"); + self.search.autocomplete("option","minLength", self.minimum_characters); + e.stopPropagation(); + } + }); this.setDOMNode(this.div[0]); },