Index: topics/forms_api_reference.html =================================================================== RCS file: /cvs/drupal-contrib/contributions/docs/developer/topics/forms_api_reference.html,v retrieving revision 1.75 diff -u -p -r1.75 forms_api_reference.html --- topics/forms_api_reference.html 6 Jan 2008 02:01:04 -0000 1.75 +++ topics/forms_api_reference.html 6 Jan 2008 03:44:34 -0000 @@ -873,7 +873,7 @@ td {

button

Description: Format an action button. When the button is pressed, the form will be submitted to Drupal, where it is validated and rebuilt. The submit handler is not invoked.

-

Properties: #attributes, #button_type (default: submit), #submit (default: FALSE), #name (default: op), #prefix, #suffix, #type. #value, #weight

+

Properties: #ahah, #attributes, #button_type (default: submit), #submit (default: FALSE), #name (default: op), #prefix, #suffix, #type. #value, #weight

Usage example (node.module):

<?php
@@ -885,7 +885,7 @@ td {

checkbox

Description: Format a checkbox.

-

Properties: #attributes, #default_value, #description, #prefix, #required, #return_value (default: 1), #suffix, #title, #type. #weight

+

Properties: #ahah, #attributes, #default_value, #description, #prefix, #required, #return_value (default: 1), #suffix, #title, #type. #weight

Usage example (contact.module):

<?php
@@ -971,7 +971,7 @@ td {

image_button

Description: Format a form submit button with an image.

-

Properties: #attributes, #button_type (default: 'submit'), #submit (default: TRUE), #name (default: 'op'), #prefix, #src, #suffix, #type. #value, #weight

+

Properties: #ahah, #attributes, #button_type (default: 'submit'), #submit (default: TRUE), #name (default: 'op'), #prefix, #src, #suffix, #type. #value, #weight

markup

Description: Generate generic markup for display inside forms. Note that there is no need to declare a form element as #type = 'markup', as this is the default type.

@@ -1000,7 +1000,7 @@ td {

password

Description: Format a single-line text field that does not display its contents visibly.

-

Properties: #attributes, #description, #maxlength (default: 30), #prefix, #required, #size (default: 64), #suffix, #title, #type. #weight

+

Properties: #ahah, #attributes, #description, #maxlength (default: 30), #prefix, #required, #size (default: 64), #suffix, #title, #type. #weight

Usage example (user.module):

<?php
@@ -1014,7 +1014,7 @@ td {

radio

Description: Format a radio button.

-

Properties: #attributes, #default_value, #description, #prefix, #required, #suffix, #title, #type. #weight

+

Properties: #ahah, #attributes, #default_value, #description, #prefix, #required, #suffix, #title, #type. #weight

Usage example:

N/A

@@ -1034,7 +1034,7 @@ td {

select

Description: Format a drop-down menu or scrolling selection box.

-

Properties: #attributes, #default_value, #description, #multiple, #options, #prefix, #required, #suffix, #title, #type. #weight

+

Properties: #ahah, #attributes, #default_value, #description, #multiple, #options, #prefix, #required, #suffix, #title, #type. #weight

Usage example (system.module):

<?php
@@ -1050,7 +1050,7 @@ td {

submit

Description: Format a form submit button.

-

Properties: #attributes, #button_type (default: 'submit'), #submit (default: TRUE), #name (default: 'op'), #prefix, #suffix, #type. #value, #weight

+

Properties: #ahah, #attributes, #button_type (default: 'submit'), #submit (default: TRUE), #name (default: 'op'), #prefix, #suffix, #type. #value, #weight

Usage example (locale.module):

<?php
@@ -1059,7 +1059,7 @@ td {

textarea

Description: Format a multiple-line text field.

-

Properties: #attributes, #cols (default: 60), #default_value, #description, #prefix, #required, #suffix, #title, #type. #rows (default: 5), #weight

+

Properties: #ahah, #attributes, #cols (default: 60), #default_value, #description, #prefix, #required, #suffix, #title, #type. #rows (default: 5), #weight

Usage example (forum.module):

<?php
@@ -1072,7 +1072,7 @@ td {

textfield

Description: Format a single-line text field.

-

Properties: #attributes, #autocomplete_path (default: FALSE), #default_value, #description, #field_prefix, #field_suffix, #maxlength (default: 128), #prefix, #required, #size (default: 60), #suffix, #title, #type. #weight

+

Properties: #ahah, #attributes, #autocomplete_path (default: FALSE), #default_value, #description, #field_prefix, #field_suffix, #maxlength (default: 128), #prefix, #required, #size (default: 60), #suffix, #title, #type. #weight

Usage example (forum.module):

<?php
@@ -1146,8 +1146,7 @@ td { checkbox, image button, password, - radio, - radios, + radio, select, submit, textarea, @@ -1161,8 +1160,9 @@ td {
  • ahah.js finds all the form elements on the page that have an #ahah['path'] set and adds an event handler for the #ahah['event'] set on that form element.
  • When the #ahah['event'] occurs on the element (such as 'click'), the AHAH request is made to the Drupal path of the element's #ahah['path'].
  • -
  • Drupal generates HTML in a second request in the background. The result is returned to the original page containing the form element.
  • -
  • ahah.js gets the result and inserts the returned HTML into the #ahah['wrapper']. Depending on the #ahah['method'], the result may affect the wrapper in different ways.
  • +
  • Drupal generates HTML in a second request in the background. While the user waits for the callback to execute a throbber or progress bar is shown as determined by #ahah['progress']. The result is returned to the original page containing the form element.
  • +
  • ahah.js gets the result and inserts the returned HTML into the #ahah['wrapper']. + Depending on the #ahah['method'], the result may affect the wrapper in different ways.
  • #ahah['effect']

    @@ -1178,28 +1178,14 @@ td {

    Values: String. Possible values: 'click', 'blur', 'change'. Note that #ahah['event'] does not need to be explicitly specified. Although it can be manually set, usually the default value will be sufficient.

    -

    For your convenience, the defaults per form element type are repeated here: -

      -
    • button: #ahah['event'] = 'click'
    • -
    • checkbox: #ahah['event'] = 'change'
    • -
    • image_button: #ahah['event'] = 'click'
    • -
    • password: #ahah['event'] = 'blur'
    • -
    • radio: #ahah['event'] = 'change'
    • -
    • radios: #ahah['event'] = 'change'
    • -
    • select: #ahah['event'] = 'change'
    • -
    • submit: #ahah['event'] = 'click'
    • -
    • textarea: #ahah['event'] = 'blur'
    • -
    • textfield: #ahah['event'] = 'blur'
    • -
    -

    -

    #ahah['method']

    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'.

    #ahah['path']

    -

    Used by: button, submit

    + +

    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):

    @@ -1209,6 +1195,21 @@ td {

    #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.

    +

    #ahah['progress']

    + +

    Description: Choose either a throbber or progress bar that is displayed while awaiting a response from the callback, and add an optional message.

    + +

    Values: Array. Possible keys: 'type', 'message'.

    +
      +
    • #ahah['progress']['type'] String. Possible values: 'throbber' (default), 'bar'.

      +
    • +
    • #ahah['progress']['message'] String. An optional message to the user; should be wrapped with t().

      +
    • +
    • #ahah['progress']['url'] String. The optional callback path to use to determine how full the progress bar is (as defined in progress.js). Only useable when 'type' is 'progress'.

      +
    • +
    +

    Usage example: see above useage in upload.module

    +

    #ahah['wrapper']

    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.