Last updated May 21, 2013. Created on December 27, 2007.
Edited by jhodgdon, kiamlaluno, xenophyle, rfay. Log in to edit this page.

Comprehensive documentation of the Form API in a single location does not currently exist. While the Form API is documented, you will be forced to piece together how it all works from various documents. In the meantime, feel free to help out by contributing new documentation, clarifying existing documentation and posting comments in this section.

Key documents you'll want to consult if you want to learn the Form API for Drupal 6

Beginners and intermediate users should consult:

Intermediate and advanced users can make use of:

Below is an outline meant as a step toward develop comprehensive documentation

  1. Overview
  2. Form creation
    1. Overview
    2. Building individual fields
      1. Example
      2. Declaring field names
        1. Nesting
        2. Tree attribute
      3. Declaring properties/attributes
        1. Link to list of all properties/attributes available
    3. Building form groups
      1. Overview
      2. Example
      3. Fieldset attribute
      4. Collapsible form groups
    4. Declaring markup
      1. Prefix/Suffix
        1. Example
      2. Markup attribute
        1. Example
    5. Weighting elements/groups
      1. Overview
      2. Example
    6. Returning forms
      1. drupal_get_form()
        1. When to use drupal_get_form
        2. Example
      2. Returning form elements
        1. When to return form elements
        2. Example
  3. Theming Forms
    1. Overview
      1. When to use form markup
      2. When to use separate theming function
    2. Example
    3. form_render()
      1. Rendering individual elements
      2. Final render
    4. Looping through the $form array
      1. Using element_children
    5. Theming individual form elements
    6. Theming form elements in a table
      1. Building the rows
  4. Validating forms
    1. Overview
    2. Example
  5. Processing forms
    1. Overview
    2. Example
    3. Converting from the POST/switch approach
    4. Displaying a confirmation message before processing a form
  6. Overriding Forms – this section needs work. No code has been written for these features as yet AFAIK
    1. Altering form elements
      1. Overview
      2. Example
    2. Custom theming
      1. Overview
      2. Example
    3. Custom validation
      1. Overview
      2. Example
    4. Custom execution
      1. Overview
      2. Example

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

willmoy’s picture

This seems to be the canonical way to do multi-stage forms, annointed in comment 1 by chx.

http://pingv.com/blog/ben-jeavons/2009/multi-step-forms-drupal-6-using-v...

and tests for multistage forms, rather than doing $this->drupalPost($path, $edit, $submit, $reporting = TRUE) form each stage of the form, do that for the first stage of the form and replace $path with NULL for subsequent stages.
q.v. http://drupal.org/node/265762