in function ajax_pre_render_element, I found this part difficult to understand,

   // 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 behavior.
        if (!isset($element ['#ajax']['prevent'])) {
          $element ['#ajax']['prevent'] = 'click';
        }

can some one help us make it clear.
what is it about, which means that click can not trigger ajax ?

thanks very much.

Comments

iaha’s picture

What it's saying is that only the ajax action will be triggered.

If you're handling a form with ajax, you don't want the form to also submit normally. That's what this helps with.