From f53401f97c30236985148e737397b16630be0f46 Mon Sep 17 00:00:00 2001
From: Bob Vincent <bobvin@pillars.net>
Date: Wed, 6 Jul 2011 09:46:39 -0400
Subject: [PATCH] Issue #1178238 by pillarsdotnet: Revised documentation for #ajax['prevent'] property.

---
 developer/topics/forms_api_reference.html |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/developer/topics/forms_api_reference.html b/developer/topics/forms_api_reference.html
index 6131d1782c140f6af5d06b742e6526f44c13dda3..81196ca02c20107086895cb10d640507eb7eb4f0 100644
--- a/developer/topics/forms_api_reference.html
+++ b/developer/topics/forms_api_reference.html
@@ -2595,14 +2595,14 @@ be called after the form or element is built.</p>
 
 <div class="codeblock"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />&nbsp; $form</span><span style="color: #007700">[</span><span style="color: #DD0000">'file_public_path'</span><span style="color: #007700">] = array(<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'textfield'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#title' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Public file system path'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#default_value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">variable_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'file_public_path'</span><span style="color: #007700">, </span><span style="color: #0000BB">conf_path</span><span style="color: #007700">() . </span><span style="color: #DD0000">'/files'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#maxlength' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">255</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#description' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'A local file system path where public files will be stored. This directory must exist and be writable by Drupal. This directory must be relative to the Drupal installation directory and be accessible over the web.'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#after_build' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'system_check_directory'</span><span style="color: #007700">),<br />&nbsp; );<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
 
-<h3><a name="ajax" id="ajax">#ajax</a></h3>
+<h3><a name="ajax" id="ajax" href="http://api.drupal.org/api/drupal/includes--ajax.inc/group/ajax">#ajax</a></h3>
 
 <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#checkbox">checkbox</a>, <a href="#checkboxes">checkboxes</a>, <a href="#hidden">hidden</a>, <a href="#image_button">image button</a>, <a href="#password">password</a>,
 <a href="#radio">radio</a>, <a href="#radios">radios</a>, <a href="#select">select</a>, <a href="#submit">submit</a>, <a href="#tableselect">tableselect</a>, <a href="#textarea">textarea</a>, <a href="#text_format">text_format</a>,
 <a href="#textfield">textfield</a> </p>
 
 <p>An array of elements whose values control the behavior of the
-element with respect to the Drupal AJAX javascript methods.</p>
+element with respect to the <a href="http://api.drupal.org/api/drupal/includes--ajax.inc/group/ajax">Drupal AJAX framework</a>.</p>
 
 <p><a href="http://en.wikipedia.org/wiki/AJAX">AJAX</a>
 (Asynchronous Javascript and XML) is a term used for dynamic
@@ -2753,16 +2753,23 @@ used for many situations.</p>
 <h3><a name="ajax_prevent" id="ajax_prevent">#ajax['prevent']</a></h3>
 
 <p><strong>Description</strong>:
-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.</p>
+A JavaScript event to prevent when 'event' is triggered. Defaults to 'click' for
+#ajax on #type 'submit', 'button', and 'image_button'. Multiple events may be
+specified separated by spaces. For example, when binding #ajax behaviors to form
+buttons, pressing the ENTER key within a textfield triggers the 'click' event of
+the form's first submit button. Triggering Ajax in this situation leads to
+problems, like breaking autocomplete textfields. Because of that, Ajax behaviors
+are bound to the 'mousedown' event on form buttons by default. However, 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. For
+this case, 'prevent' can be set to 'click', so an additional event handler is
+bound to prevent such a click from triggering a non-Ajax form submission. This
+also prevents a textfield's ENTER press triggering a button's non-Ajax form
+submission behavior.</p>
 
 <p><strong>Values</strong>:
-String. Possible values: Any valid <a href="http://docs.jquery.com/Events">jQuery event</a>, including 'click' (default), 'mousedown', 'blur', 'change', etc.</p>
+String. Possible values: One or more <a href="http://docs.jquery.com/Events">jQuery events</a>, with <a href="http://api.jquery.com/bind#multiple-events">multiple events</a> separated by space characters.</p>
 
 <h3><a name="ajax_progress" id="ajax_progress">#ajax['progress']</a></h3>
 
-- 
1.7.4.1

