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 @@
Property names without # signs causes havoc.
+Description: Specifies the effect used when adding the content from an AHAH request.
+Values: String. Possible values: 'none' (default), 'fade', 'slide'. If the interface elements library is installed, any effect with the name effectToggle may also be used.
+Description: When this event occurs to this element, Drupal will perform an HTTP request in the background via Javascript. The ahah_ prefix refers to AHAH javascript replacement (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:
+Values: String. Possible values: 'submit'. Defaults for #ahah_event are set per form element type. See default element parameters.
+Usage example (upload.module):
+
+ <?php
$form['new']['attach'] = array(
'#type' => 'submit',
'#value' => t('Attach'),
'#name' => 'attach',
'#ahah_path' => 'upload/js',
'#ahah_wrapper' => 'attach-wrapper',
'#submit' => array(),
);
?>
+Note that #ahah_event is not specified explicitly. Although it can be manually set, usually the default parameter will be sufficient.
+Description: Modify the behavior of the returned HTML from an AHAH request when inserting into the #ahah_wrapper. 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 jQuery operations for DOM manipulation.
+Values: String. Possible values: 'replace' (default), 'after', 'append', 'before', 'prepend'.
+Description: 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 #ahah_wrapper.
+Values: String containing a Drupal menu path.
+Usage example (upload.module):
+<?php
+ /**
+ * Implementation of hook_menu().
+ */
+ function upload_menu() {
+ $items['upload/js'] = array(
+ 'page callback' => 'upload_js',
+ 'access arguments' => array('upload files'),
+ 'type' => MENU_CALLBACK,
+ );
+ ...
return $items;
+ }
...
$form['new']['attach'] = array(
+ '#type' => 'submit',
+ '#value' => t('Attach'),
+ '#name' => 'attach',
+ '#ahah_path' => 'upload/js',
+ '#ahah_wrapper' => 'attach-wrapper',
+ '#submit' => array(),
+ );
+ ?>
#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.
+Description: 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.
+Values: String containg a valid id attribute of an HTML element on the same page.
+Usage example (upload.module):
+<?php
+ $form['attachments']['wrapper'] = array(
+ '#prefix' => '<div id="attach-wrapper">',
+ '#suffix' => '</div>',
+ );
+ ...
$form['new']['attach'] = array(
+ '#type' => 'submit',
+ '#value' => t('Attach'),
+ '#name' => 'attach',
+ '#ahah_path' => 'upload/js',
+ '#ahah_wrapper' => 'attach-wrapper',
+ '#submit' => array(),
+ );
+ ?>
Used by: button, checkbox, checkboxes, date, fieldset, file, form, markup, password, radio, radios, select, submit, textarea, textfield, weight
Description: Additional HTML attributes, such as 'class' can be set using this mechanism.