summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-02-12 13:52:33 +0000
committerDries Buytaert <dries@buytaert.net>2008-02-12 13:52:33 +0000
commit1d390ef36c996a30b462e406f5c63139539df87b (patch)
treeddaa9531db7f777bc6e5446d16b68da68b740366 /includes
parent0f1085201e6aeded3119075dd3ef442317c026c2 (diff)
downloadbrdo-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 'includes')
-rw-r--r--includes/form.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 473e67bc7..eb9434338 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1749,7 +1749,13 @@ function form_expand_ahah($element) {
case 'submit':
case 'button':
case 'image_button':
- $element['#ahah']['event'] = 'click';
+ // Use the mousedown instead of the click event because form
+ // submission via pressing the enter key triggers a click event on
+ // submit inputs, inappropriately triggering AHAH behaviors.
+ $element['#ahah']['event'] = 'mousedown';
+ // Attach an additional event handler so that AHAH behaviours
+ // can be triggered still via keyboard input.
+ $element['#ahah']['keypress'] = TRUE;
break;
case 'password':
case 'textfield':
@@ -1773,6 +1779,7 @@ function form_expand_ahah($element) {
$ahah_binding = array(
'url' => url($element['#ahah']['path']),
'event' => $element['#ahah']['event'],
+ 'keypress' => empty($element['#ahah']['keypress']) ? NULL : $element['#ahah']['keypress'],
'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'],
'selector' => empty($element['#ahah']['selector']) ? '#'. $element['#id'] : $element['#ahah']['selector'],
'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'],