Warning message

Documentation is currently being migrated into the new system. Some pages might be temporarily missing, and some guides might appear empty. Thank you for your patience while we are improving Drupal.org documentation.

New #ajax['prevent'] property added in 7.5

Last updated on
October 15, 2016 - 22:13

See http://drupal.org/node/634616#comment-4681706

A new #ajax['prevent'] setting was added, defaulting to 'click'

Binding to mousedown rather than click means that it is possible to trigger a
click by pressing the mouse, holding the mouse button down until the Ajax
request is complete and the button is re-enabled, and then releasing the mouse
button. Set 'prevent' so that ajax.js binds an additional handler to prevent
such a click from triggering a non-Ajax form submission. This also prevents a
textfield's ENTER press triggering this button's non-Ajax form submission