diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-02-12 13:52:33 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-02-12 13:52:33 +0000 |
commit | 1d390ef36c996a30b462e406f5c63139539df87b (patch) | |
tree | ddaa9531db7f777bc6e5446d16b68da68b740366 /misc | |
parent | 0f1085201e6aeded3119075dd3ef442317c026c2 (diff) | |
download | brdo-1d390ef36c996a30b462e406f5c63139539df87b.tar.gz brdo-1d390ef36c996a30b462e406f5c63139539df87b.tar.bz2 |
- Patch #216059 by nedjo, theborg, karens, goba, webchick et al: AHAH triggered by text input enter key press breaks autocomplete.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/ahah.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/misc/ahah.js b/misc/ahah.js index 775159d6b..a098addb9 100644 --- a/misc/ahah.js +++ b/misc/ahah.js @@ -38,6 +38,7 @@ Drupal.ahah = function(base, element_settings) { this.element = element_settings.element; this.selector = element_settings.selector; this.event = element_settings.event; + this.keypress = element_settings.keypress; this.url = element_settings.url; this.wrapper = '#'+ element_settings.wrapper; this.effect = element_settings.effect; @@ -98,6 +99,18 @@ Drupal.ahah = function(base, element_settings) { $(element_settings.element).parents('form').ajaxSubmit(options); return false; }); + // If necessary, enable keyboard submission so that AHAH behaviors + // can be triggered through keyboard input as well as e.g. a mousedown + // action. + if (element_settings.keypress) { + $(element_settings.element).keypress(function(event) { + // Detect enter key. + if (event.keyCode == 13) { + $(element_settings.element).trigger(element_settings.event); + return false; + } + }); + } }; /** |