diff --git includes/ajax.inc includes/ajax.inc index 7ef41bc..371ebb2 100644 --- includes/ajax.inc +++ includes/ajax.inc @@ -587,12 +587,19 @@ function ajax_pre_render_element($element) { $element['#ajax']['event'] = 'blur'; break; - case 'radio': - case 'checkbox': case 'select': $element['#ajax']['event'] = 'change'; break; + // Note on 'change' versus 'click' events: Ideally we would fire an AJAX + // request for radios and checkboxes when they change, instead of every + // time they're clicked. Unfortunately, Internet Explorer doesn't fire + // change events correctly. For radio and checkbox elements, the change + // event fires only on blur (such as when the user clicks outside the form + // element). The workaround is to react on the click event instead of the + // change event. See http://www.quirksmode.org/dom/events/change.html#t04 + case 'radio': + case 'checkbox': case 'link': $element['#ajax']['event'] = 'click'; break; diff --git misc/ajax.js misc/ajax.js index a7dc21a..68e5146 100644 --- misc/ajax.js +++ misc/ajax.js @@ -250,15 +250,7 @@ Drupal.ajax.prototype.eventResponse = function (element, event) { alert("An error occurred while attempting to process " + ajax.options.url + ": " + e.message); } - // For radio/checkbox, allow the default event. On IE, this means letting - // it actually check the box. - if (typeof element.type != 'undefined' && (element.type == 'checkbox' || element.type == 'radio')) { - return true; - } - else { - return false; - } - + return false; }; /**