Index: forms_api_reference.html
===================================================================
RCS file: /cvs/drupal-contrib/contributions/docs/developer/topics/forms_api_reference.html,v
retrieving revision 1.56
diff -u -r1.56 forms_api_reference.html
--- forms_api_reference.html	13 Mar 2007 16:44:32 -0000	1.56
+++ forms_api_reference.html	28 Jun 2007 17:42:16 -0000
@@ -76,7 +76,6 @@
 
       <th scope="col"><a href="#weight">weight</a></th>
     </tr>
-
     <tr>
       <th scope="row"><a href="#after_build">#after_build</a></th>
 
@@ -104,7 +103,6 @@
 
       <td class="x"><strong>X</strong></td>
     </tr>
-
     <tr>
       <th scope="row"><a href="#attributes">#attributes</a></th>
 
@@ -882,7 +880,6 @@
 
       <th scope="col"><a href="#val">value</a></th>
     </tr>
-
     <tr>
       <th scope="row"><a href="#after_build">#after_build</a></th>
 
@@ -897,7 +894,56 @@
       <td class="x"><strong>X</strong></td>
 
       <td class="x"><strong>X</strong></td>
-
+      <td>-</td>
+    </tr>
+    <tr>
+      <th scope="row"><a href="#ahah_effect">#ahah_effect</a></th>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+    </tr>
+    <tr>
+      <th scope="row"><a href="#ahah_event">#ahah_event</a></th>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+    </tr>
+    <tr>
+      <th scope="row"><a href="#ahah_method">#ahah_method</a></th>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+    </tr>
+    <tr>
+      <th scope="row"><a href="#ahah_path">#ahah_path</a></th>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+    </tr>
+    <tr>
+      <th scope="row"><a href="#ahah_wrapper">#ahah_wrapper</a></th>
+      <td class="x"><strong>X</strong></td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td>-</td>
+      <td class="x"><strong>X</strong></td>
       <td>-</td>
     </tr>
 
@@ -1308,6 +1354,7 @@
         <li><a href="#button_type">#button_type</a> = 'submit'</li>
 
         <li><a href="#submit_property">#submit</a> = FALSE</li>
+        <li><a href="#ahah_event">#ahah_event</a> = 'submit' </li>
       </ul>
     </li>
 
@@ -1394,6 +1441,7 @@
         <li><a href="#button_type">#button_type</a> = 'submit'</li>
 
         <li><a href="#submit_property">#submit</a> = TRUE</li>
+        <li><a href="#ahah_event">#ahah_event</a> = 'submit' </li>
       </ul>
     </li>
 
@@ -1786,8 +1834,83 @@
 
   <p>Property names without # signs causes havoc.</p>
 
+  <h3><a name="ahah_effect" id="ahah_effect"></a>#ahah_effect</h3>
+  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#submit">submit</a></p>
+  <p><strong>Description</strong>: Specifies the effect used when adding the content from an AHAH request. </p>
+  <p><strong>Values</strong>: String. Possible values: 'none' (default), 'fade', 'slide'. If the <a href="http://interface.eyecon.ro/">interface elements library</a> is installed, any effect with the name <em>effect</em>Toggle may also be used. </p>
+  <h3><a name="ahah_event" id="ahah_event"></a>#ahah_event</h3>
+  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#submit">submit</a></p>
+  <p><strong>Description</strong>: When this event occurs to this element, Drupal will perform an HTTP request in the background via Javascript. The ahah_ prefix refers to <a href="http://en.wikipedia.org/wiki/AHAH">AHAH javascript replacement</a> (Asychronous HTML and HTTP), a relative of AJAX. AHAH is both the easiest and straight forward form of javascript page replacement. In a nutshell an AHAH request follows these steps:</p>
+  <ol>
+    <li>Drupal builds a form element with a set of #ahah properties set. The misc/ahah.js file is included on the page automatically. </li>
+    <li>ahah.js finds all the form elements on the page that have an <a href="#ahah_path">#ahah_path</a> set and adds an event handler for the <a href="#ahah_event">#ahah_event</a> set on that form element.</li>
+    <li>When the <a href="ahah_event">#ahah_event</a> occurs on the element (such as 'submit'), the AHAH request is made to the Drupal path of the element's <a href="ahah_path">#ahah_path</a>.<br />
+    </li>
+    <li>Drupal generates HTML in a second request in the background. The result is returned to the original page containing the form element.</li>
+    <li>ahah.js gets the result and inserts the returned HTML into the <a href="ahah_wrapper">#ahah_wrapper</a>. Depending on the <a href="#ahah_method">#ahah_method</a>, the result may affect the wrapper in different ways. </li>
+  </ol>
+  <p><strong>Values</strong>: String. Possible values: 'submit'. Defaults for #ahah_event are set per form element type. See <a href="#default_element_parameters">default element parameters</a>. </p>
+  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/HEAD/file/modules/upload/upload.module">upload.module</a>):</p>
+  <div class="codeblock"><code>
+    <p><font color="#000000"><font color="#0000bb">&lt;?php<br>$form</font><font color="#007700">[</font><font color="#dd0000">'new'</font><font color="#007700">][</font><font color="#dd0000">'attach'</font><font color="#007700">] = array(<br>&nbsp; </font><font color="#dd0000">'#type' </font><font color="#007700">=&gt; </font><font color="#dd0000">'submit'</font><font color="#007700">,<br>&nbsp; </font><font color="#dd0000">'#value' </font><font color="#007700">=&gt; </font><font color="#0000bb">t</font><font color="#007700">(</font><font color="#dd0000">'Attach'</font><font color="#007700">),<br>&nbsp; </font><font color="#dd0000">'#name' </font><font color="#007700">=&gt; </font><font color="#dd0000">'attach'</font><font color="#007700">,<br>&nbsp; </font><font color="#dd0000">'#ahah_path' </font><font color="#007700">=&gt; </font><font color="#dd0000">'upload/js'</font><font color="#007700">,<br>&nbsp; </font><font color="#dd0000">'#ahah_wrapper' </font><font color="#007700">=&gt; </font><font color="#dd0000">'attach-wrapper'</font><font color="#007700">,<br>&nbsp; </font><font color="#dd0000">'#submit' </font><font color="#007700">=&gt; array(),<br>);<br></font><font color="#0000bb">?&gt;</font></font></p>
+</code></div>
+  <p>Note that #ahah_event is not specified explicitly. Although it can be manually set, usually the <a href="#default_element_parameters">default parameter</a> will be sufficient.</p>
+  <h3><a name="ahah_event" id="ahah_event"></a>#ahah_method</h3>
+  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#submit">submit</a></p>
+  <p><strong>Description</strong>: Modify the behavior of the returned HTML from an AHAH request when inserting into the <a href="#ahah_wrapper">#ahah_wrapper</a>. If not set, the returned HTML will replace the contents of the wrapper element, but it's also possible to use any of the available <a href="http://docs.jquery.com/DOM/Manipulation">jQuery operations for DOM manipulation</a>. </p>
+  <p><strong>Values</strong>: String. Possible values: 'replace' (default), 'after', 'append', 'before', 'prepend'.</p>
+  <h3><a name="ahah_path" id="ahah_path"></a>#ahah_path</h3>
+  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#submit">submit</a></p>
+  <p><strong>Description</strong>: If set, this property triggers AHAH behaviors on a form element. This is the Drupal menu path to a callback function which will generate HTML and return the string of HTML to Drupal. The result will be placed in the div specified in <a href="#ahah_wrapper">#ahah_wrapper</a>. </p>
+  <p><strong>Values</strong>: String containing a Drupal menu path.</p>
+  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/HEAD/file/modules/upload/upload.module">upload.module</a>):</p>
+  <div class="codeblock"><code><font color="#000000"><font color="#0000bb">&lt;?php<br />
+    </font><font color="#ff8000">/**<br />
+      * Implementation of hook_menu().<br />
+      */<br />
+      </font><font color="#007700">function </font><font color="#0000bb">upload_menu</font><font color="#007700">() {<br />
+        &nbsp; </font><font color="#0000bb">$items</font><font color="#007700">[</font><font color="#dd0000">'upload/js'</font><font color="#007700">] = array(<br />
+          &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'page callback' </font><font color="#007700">=&gt; </font><font color="#dd0000">'upload_js'</font><font color="#007700">,<br />
+            &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'access arguments' </font><font color="#007700">=&gt; array(</font><font color="#dd0000">'upload files'</font><font color="#007700">),<br />
+              &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'type' </font><font color="#007700">=&gt; </font><font color="#0000bb">MENU_CALLBACK</font><font color="#007700">,<br />
+                &nbsp; ); </font></font></code>
+      <p><code><font color="#000000"><font color="#007700">&nbsp; ...</font></font></code></p>
+    <p><code><font color="#000000"><font color="#007700">&nbsp; return </font><font color="#0000bb">$items</font><font color="#007700">;<br />
+      }</font></font></code></p>
+    <p><code><font color="#000000"><font color="#007700">   ...</font></font></code></p>
+    <p><code><font color="#000000"><font color="#007700">&nbsp; </font><font color="#0000bb">$form</font><font color="#007700">[</font><font color="#dd0000">'new'</font><font color="#007700">][</font><font color="#dd0000">'attach'</font><font color="#007700">] = array(<br />
+      &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#type' </font><font color="#007700">=&gt; </font><font color="#dd0000">'submit'</font><font color="#007700">,<br />
+        &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#value' </font><font color="#007700">=&gt; </font><font color="#0000bb">t</font><font color="#007700">(</font><font color="#dd0000">'Attach'</font><font color="#007700">),<br />
+          &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#name' </font><font color="#007700">=&gt; </font><font color="#dd0000">'attach'</font><font color="#007700">,<br />
+            &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#ahah_path' </font><font color="#007700">=&gt; </font><font color="#dd0000">'upload/js'</font><font color="#007700">,<br />
+              &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#ahah_wrapper' </font><font color="#007700">=&gt; </font><font color="#dd0000">'attach-wrapper'</font><font color="#007700">,<br />
+                &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#submit' </font><font color="#007700">=&gt; array(),<br />
+                  &nbsp; );<br />
+                </font><font color="#0000bb">?&gt;</font></font></code></p>
+  </div>
+  <p>#ahah_path is set to 'upload/js', which has a menu item defined in the same module. Then the menu hook will call the 'upload_js' function which generates HTML and returns it to original page.</p>
+<h3><a name="ahah_wrapper" id="ahah_wrapper"></a>#ahah_wrapper</h3>
+  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#submit">submit</a></p>
+  <p><strong>Description</strong>: This property defines the HTML id attribute of an element on the page will server as the destination for HTML returned by an AHAH request. Usually, a div element is used as the wrapper, as it provides the most flexibility for placement of elements before, after, or inside of it's HTML tags. This property  is required for using AHAH requests in on a form element.</p>
+  <p><strong>Values</strong>: String containg a valid id attribute of an HTML element on the same page.</p>
+  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/HEAD/file/modules/upload/upload.module">upload.module</a>):</p>
+  <div class="codeblock"><code><font color="#000000"><font color="#0000bb">&lt;?php<br />
+    &nbsp; $form</font><font color="#007700">[</font><font color="#dd0000">'attachments'</font><font color="#007700">][</font><font color="#dd0000">'wrapper'</font><font color="#007700">] = array(<br />
+      &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#prefix' </font><font color="#007700">=&gt; </font><font color="#dd0000">'&lt;div id=&quot;attach-wrapper&quot;&gt;'</font><font color="#007700">,<br />
+        &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#suffix' </font><font color="#007700">=&gt; </font><font color="#dd0000">'&lt;/div&gt;'</font><font color="#007700">,<br />
+          &nbsp; ); </font></font></code>
+      <p><code><font color="#000000"><font color="#007700">...</font></font></code></p>
+    <p><code><font color="#000000"><font color="#007700">&nbsp; </font><font color="#0000bb">$form</font><font color="#007700">[</font><font color="#dd0000">'new'</font><font color="#007700">][</font><font color="#dd0000">'attach'</font><font color="#007700">] = array(<br />
+      &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#type' </font><font color="#007700">=&gt; </font><font color="#dd0000">'submit'</font><font color="#007700">,<br />
+        &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#value' </font><font color="#007700">=&gt; </font><font color="#0000bb">t</font><font color="#007700">(</font><font color="#dd0000">'Attach'</font><font color="#007700">),<br />
+          &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#name' </font><font color="#007700">=&gt; </font><font color="#dd0000">'attach'</font><font color="#007700">,<br />
+            &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#ahah_path' </font><font color="#007700">=&gt; </font><font color="#dd0000">'upload/js'</font><font color="#007700">,<br />
+              &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#ahah_wrapper' </font><font color="#007700">=&gt; </font><font color="#dd0000">'attach-wrapper'</font><font color="#007700">,<br />
+                &nbsp;&nbsp;&nbsp; </font><font color="#dd0000">'#submit' </font><font color="#007700">=&gt; array(),<br />
+                  &nbsp; );<br />
+                </font><font color="#0000bb">?&gt;</font></font></code></p>
+</div>
   <h3><a name="attributes" id="attributes"></a>#attributes</h3>
-
   <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#checkbox">checkbox</a>, <a href="#checkboxes">checkboxes</a>, <a href="#date">date</a>, <a href="#fieldset">fieldset</a>, <a href="#file">file</a>, <a href="#form">form</a>, <a href="#markup">markup</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="#textarea">textarea</a>, <a href="#textfield">textfield</a>, <a href="#weight">weight</a></p>
 
   <p><strong>Description</strong>: Additional HTML attributes, such as 'class' can be set using this mechanism.</p>
