Index: includes/ajax.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/ajax.inc,v retrieving revision 1.41 diff -u -p -r1.41 ajax.inc --- includes/ajax.inc 23 Dec 2010 04:26:31 -0000 1.41 +++ includes/ajax.inc 26 Dec 2010 00:31:23 -0000 @@ -587,13 +587,8 @@ function ajax_pre_render_element($elemen case 'submit': case 'button': case 'image_button': - // 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 AJAX behaviors. - $element['#ajax']['event'] = 'mousedown'; - // Attach an additional event handler so that AJAX behaviors - // can be triggered still via keyboard input. - $element['#ajax']['keypress'] = TRUE; + case 'link': + $element['#ajax']['event'] = 'click'; break; case 'password': @@ -608,10 +603,6 @@ function ajax_pre_render_element($elemen $element['#ajax']['event'] = 'change'; break; - case 'link': - $element['#ajax']['event'] = 'click'; - break; - default: return $element; } Index: misc/ajax.js =================================================================== RCS file: /cvs/drupal/drupal/misc/ajax.js,v retrieving revision 1.35 diff -u -p -r1.35 ajax.js --- misc/ajax.js 23 Dec 2010 04:26:31 -0000 1.35 +++ misc/ajax.js 26 Dec 2010 00:31:24 -0000 @@ -41,7 +41,7 @@ Drupal.behaviors.AJAX = { $('.use-ajax:not(.ajax-processed)').addClass('ajax-processed').each(function () { var element_settings = {}; // Clicked links look better with the throbber than the progress bar. - element_settings.progress = { 'type': 'throbber' }; + element_settings.progress = {'type': 'throbber'}; // For anchor tags, these will go to the target of the anchor rather // than the usual location. @@ -55,7 +55,7 @@ Drupal.behaviors.AJAX = { // This class means to submit the form to the action using AJAX. $('.use-ajax-submit:not(.ajax-processed)').addClass('ajax-processed').each(function () { - var element_settings = {}; + var element_settings = {event: 'click'}; // AJAX submits specified in this manner automatically submit to the // normal form action. @@ -63,14 +63,24 @@ Drupal.behaviors.AJAX = { // Form submit button clicks need to tell the form what was clicked so // it gets passed in the POST request. element_settings.setClick = true; - // Form buttons use the 'click' event rather than mousedown. - element_settings.event = 'click'; // Clicked form buttons look better with the throbber than the progress bar. - element_settings.progress = { 'type': 'throbber' }; + element_settings.progress = {'type': 'throbber'}; var base = $(this).attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); }); + + // Browsers trigger the click event of the first submit button when ENTER is + // pressed from a textfield. When there is more than one submit button, this + // usually leads to untuitive behavior, so disable this browser feature. + // @todo This probably does not belong in ajax.js. + $('input:text', context).once('TODO-NEED-NAME', function() { + $(this).keypress(function(event) { + if (event.which == 13 && $('input:submit, input:image', this.form).length > 1) { + event.preventDefault(); + } + }); + }); } }; @@ -99,8 +109,8 @@ Drupal.behaviors.AJAX = { Drupal.ajax = function (base, element, element_settings) { var defaults = { url: 'system/ajax', - event: 'mousedown', - keypress: true, + event: 'click', + keypress: false, selector: '#' + base, effect: 'none', speed: 'none', Index: modules/field_ui/field_ui.js =================================================================== RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.js,v retrieving revision 1.8 diff -u -p -r1.8 field_ui.js --- modules/field_ui/field_ui.js 21 Nov 2010 08:50:49 -0000 1.8 +++ modules/field_ui/field_ui.js 26 Dec 2010 00:32:05 -0000 @@ -236,7 +236,7 @@ Drupal.fieldUIOverview = { // Fire the AJAX update. $('input[name=refresh_rows]').val(rowNames.join(' ')); - $('input#edit-refresh').mousedown(); + $('input#edit-refresh').click(); // Disabled elements do not appear in POST ajax data, so we mark the // elements disabled only after firing the request.