Form API Reference

You are here

  1. 7 developer/topics/forms_api_reference.html
  2. 4.7 developer/topics/forms_api_reference.html
  3. 5 developer/topics/forms_api_reference.html
  4. 6 developer/topics/forms_api_reference.html
  5. 8 developer/topics/forms_api_reference.html

This document provides a programmer's reference to the Drupal Forms API. If you're interested in step-by-step documentation to help you write forms, please see the Forms API QuickStart guide.

Skip to: Properties | Default Values | Elements

Form Controls

Legend:
X = attribute can be used with this type
- = this attribute is not applicable to this type

#type checkbox checkboxes date fieldset file password password_confirm radio radios select textarea textfield weight
#access X X X X X X X X X X X X X
#after_build X X X X X X X X X X X X X
#ahah X - - - - X - X - X X X -
#attributes X X X X X X - X X X X X X
#autocomplete_path - - - - - - - - - - - X -
#collapsed - - - X - - - - - - - - -
#collapsible - - - X - - - - - - - - -
#cols - - - - - - - - - - X - -
#default_value X X X - - - - X X X X X X
#delta - - - - - - - - - - - - X
#description X X X X X X X X X X X X X
#disabled X X X - X X X X X X X X X
#element_validate X X X X X X X X X X X X X
#field_prefix - - - - - - - - - - - X -
#field_suffix - - - - - - - - - - - X -
#maxlength - - - - - X - - - - - X -
#multiple - - - - - - - - - X - - -
#options - X - - - - - - X X - - -
#parents X X X X X X X X X X X X X
#post_render X X X X X X X X X X X X X
#prefix X X X X X X X X X X X X X
#pre_render X X X X X X X X X X X X X
#process X X X X X X X X X X X X X
#required X X X - - X X X X X X X X
#resizable - - - - - - - - - - X - -
#return_value X - - - - - - X - - - - -
#rows - - - - - - - - - - X - -
#size - - - - X X X - - X - X -
#suffix X X X X X X X X X X X X X
#theme X X X X X X X X X X X X X
#title X X X X X X X X X X X X X
#tree X X X X X X X X X X X X X
#weight X X X X X X X X X X X X X

Special Elements

#type button image_button submit form hidden token markup item value
#access X X X X X X X X -
#action - - - X - - - - -
#after_build X X X X X X X X -
#ahah X X X - X - - - -
#attributes X X X X - - - - -
#button_type X X X - - - - - -
#default_value - - - - X X - - -
#description - - - - - - - X -
#disabled X X X - - - - - -
#element_validate X X X - X X X X -
#executes_submit_callback X X X - - - - - -
#method - - - X - - - - -
#name X - X - - - - - -
#parents X X X - X X X X -
#post_render X X X X X X X X -
#prefix X X X X X X X X -
#pre_render X X X X X X X X -
#process X X X X X X - - -
#redirect - - - X - - - - -
#return_value - X - - - - - - -
#src - X - - - - - - -
#submit X X X X - - - - -
#suffix X X X X X X X X -
#theme X X X X X X X X -
#title - - - - - - - X -
#tree X X X X X X X X -
#validate X X X X - - - - -
#value X X X - X X X X X
#weight X X X - X X X X -

Default Values

Every element automatically has these default values (see _element_info):

The following is a list of default values which do not need to be set (found in system_elements):

 

Elements

Note that property names in bold are those that will generally need to be defined when creating this form element. Default values are indicated in parentheses next to property names, if they exist.

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: #access, #after_build, #ahah, #attributes, #button_type (default: submit), #disabled, #element_validate, #executes_submit_callback (default: FALSE), #name (default: op), #parents, #post_render, #prefix, #pre_render, #process, #submit, #suffix, #theme, #tree, #type, #validate, #value, #weight

Usage example (node.module):

<?php
$form
['preview'] = array(
 
'#type' => 'button',
  '#value'
=> t('Preview'),
  '#weight'
=> 19,
);
?>

checkbox

Description: Format a checkbox.

Properties: #access, #after_build, #ahah, #attributes, #default_value, #description, #disabled, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #required, #return_value (default: 1), #suffix, #theme, #title, #tree, #type, #weight

Usage example (contact.module):

<?php
$form
['copy'] = array(
 
'#type' => 'checkbox',
  '#title'
=> t('Send me a copy.'),
);
?>

checkboxes

Description: Format a set of checkboxes. #options is an associative array, where the key is the #return_value of the checkbox and the value is displayed. The #options array can not have a 0 key, as it would not be possible to discern checked and unchecked states.

Properties: #access, #after_build, #attributes, #default_value, #description, #disabled, #element_validate, #options, #parents, #post_render, #prefix, #pre_render, #process, #required, #suffix, #theme, #title, #tree (default: TRUE), #type, #weight

Usage example (node.module):

<?php
$form
['node_options_'. $node->type] = array(
  '#type' => 'checkboxes',
  '#title'
=> t('Default options'),
  '#default_value'
=> variable_get('node_options_'. $node->type, array('status', 'promote')),
  '#options' => array(
    'status'
=> t('Published'),
    'moderate'
=> t('In moderation queue'),
    'promote'
=> t('Promoted to front page'),
    
'sticky' => t('Sticky at top of lists'),
    
'revision' => t('Create new revision'),
  ),

  '#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.'),
);
?>

date

Description: Format a date selection box. The #default_value will be today's date if no value is supplied. The format for the #default_value and the #return_value is an array with three elements with the keys: 'year', month', and 'day'. For example, array('year' => 2007, 'month' => 2, 'day' => 15)

Properties: #access, #after_build, #attributes, #default_value, #description, #disabled, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #required, #suffix, #theme, #title, #tree, #type, #weight

Usage example (profile.module):

<?php
$fields
[$category][$field->name] = array(
  
'#type' => 'date',
  '#title'
=> check_plain($field->title),
  '#default_value'
=> $edit[$field->name],
  '#description'
=> _profile_form_explanation($field),
  '#required'
=> $field->required
);
?>

fieldset

Description: Format a group of form items.

Properties: #access, #after_build, #attributes, #collapsed (default: FALSE), #collapsible (default: FALSE), #description, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #suffix, #theme, #title, #tree, #type, #weight

Usage example (contact.module):

<?php
$form
['contact'] = array(
  '#type'
=> 'fieldset',
  '#title'
=> t('Contact settings'),
  '#weight'
=> 5,
  '#collapsible'
=> TRUE,
  '#collapsed'
=> FALSE,
);
?>

file

Description: Format a file upload field.

Note: you will need to include $form['#attributes'] = array('enctype' => "multipart/form-data"); in your form. See this handbook page for an example http://drupal.org/node/111782.

Note: the #required property is not supported (setting it to true will always cause a validation error). Instead, you may want to use your own validation function to do checks on the $_FILES array with #required set to false. You will also have to add your own required asterisk if you would like one.

Properties: #access, #after_build, #attributes, #description, #disabled, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #size (default: 60), #suffix, #theme, #title, #tree, #type, #weight

Usage example (upload.module):

<?php
$form
['new']['upload'] = array(
 
'#type' => 'file',
  '#title'
=> t('Attach new file'),
  '#size'
=> 40,
);
?>

form

Description: A form containing form elements

Properties: #access, #action (default: request_uri()), #after_build, #attributes, #method (default: 'post'), #post_render, #prefix, #pre_render, #redirect, #submit, #suffix, #theme, #tree, #validate

Usage example:

N/A

hidden

Description: Store data in a hidden form field.

Properties: #access, #after_build, #ahah, #default_value, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #suffix, #theme, #tree, #type, #value

Usage example (block.module):

<?php
$form
['bid'] = array('#type' => 'hidden', '#value' => $bid);
?>

Note that if you plan to use JavaScript to change your hidden element's value, you will need to use the #default_value property rather than #value.

image_button

Description: Format a form submit button with an image. Note: using multiple image_buttons with #value set will make the submission think the last defined was the $form_state['clicked_button'].

Properties: #access, #after_build, #ahah, #attributes, #button_type (default: 'submit'), #disabled, #element_validate, #executes_submit_callback (default: TRUE), #parents, #post_render, #prefix, #pre_render, #process, #return_value (default: TRUE), #src, #submit, #suffix, #theme, #tree, #type, #validate, #value, #weight

item

Description: Generate a display-only form element allowing for an optional title and description.

Note: since this is a read-only field, setting the #required property will do nothing except theme the form element to look as if it were actually required (i.e. by placing a red star next to the #title).

Properties: #access, #after_build, #description, #element_validate, #parents, #post_render, #prefix, #pre_render, #required, #suffix, #theme, #title, #tree, #type, #value, #weight

Usage example (contact.module):

<?php
$form['from'] = array(
  
'#type' => 'item',
  '#title' => t('From'),
  '#value' => $user->name .' &lt;'. $user->mail .'&gt;',
);

?>

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.

Note: if you use markup, if your content is not wrapped in tags (generally <p> or <div>), your content will fall outside of collapsed fieldsets.

Properties: #access, #after_build, #element_validate, #parents, #post_render, #prefix, #pre_render, #suffix, #theme, #tree, #type, #value, #weight

Usage example (contact.module):

<?php
$form
['contact_information'] = array(
  '#value'
=> variable_get('contact_form_information', t('You can leave us a message using the contact form below.')),
);
?>

password

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

Properties: #access, #after_build, #ahah, #attributes, #description, #disabled, #element_validate, #maxlength (default: 128), #parents, #post_render, #prefix, #pre_render, #process, #required, #size (default: 60), #suffix, #theme, #title, #tree, #type, #weight

Usage example (user.module):

<?php
$form
['pass'] = array(
  '#type'
=> 'password',
  '#title'
=> t('Password'),
  '#maxlength'
=> 64,
  '#size'
=> 15,
);
?>

password_confirm

Description: Format a pair of password fields, which do not validate unless the two entered passwords match.

Properties: #access, #after_build, #description, #disabled, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #required, #size (default: 60), #suffix, #theme, #title, #tree, #type, #weight

Usage example (user.module):

<?php
$form
['pass'] = array(
  '#type'
=> 'password_confirm',
  '#title'
=> t('Password'),
  '#size'
=> 25,
);
?>

radio

Description: Format a radio button.

Properties: #access, #after_build, #ahah, #attributes, #default_value, #description, #disabled, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #required, #return_value, #suffix, #theme, #title, #tree, #type, #weight

Usage example:

N/A

radios

Description: Format a set of radio buttons.

Properties: #access, #after_build, #attributes, #default_value, #description, #disabled, #element_validate, #options, #parents, #post_render, #prefix, #pre_render, #process, #required, #suffix, #theme, #title, #tree, #type, #weight

Usage example (comment.module):

<?php
$form
['posting_settings']['comment_preview'] = array(
  
'#type' => 'radios',
  '#title'
=> t('Preview comment'),
  '#default_value'
=> variable_get('comment_preview', 1),
  '#options'
=> array(t('Optional'), t('Required')),
);
?>

select

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

Properties: #access, #after_build, #ahah, #attributes, #default_value, #description, #disabled, #element_validate, #multiple, #options, #parents, #post_render, #prefix, #pre_render, #process, #required, #size, #suffix, #theme, #title, #tree, #type, #weight

Usage example (system.module):

<?php
$form
['feed']['feed_item_length'] = array(
  '#type' => 'select',
  '#title'
=> t('Display of XML feed items'),
  '#default_value'
=> variable_get('feed_item_length','teaser'),
  '#options' => array(
    'title'
=> t('Titles only'),
    'teaser'
=> t('Titles plus teaser'),
    'fulltext'
=> t('Full text'),
  ),
  '#description' => t('Global setting for the length of XML feed items that are output by default.'),
);
?>

submit

Description: Format a form submit button.

Properties: #access, #after_build, #ahah, #attributes, #button_type (default: 'submit'), #disabled, #element_validate, #executes_submit_callback (default: TRUE), #name (default: 'op'), #parents, #post_render, #prefix, #pre_render, #process, #submit, #suffix, #theme, #tree, #type, #validate, #value, #weight

Usage example (locale.module):

<?php
$form
['submit'] = array('#type' => 'submit', '#value' => t('Import'));
?>

textarea

Description: Format a multiple-line text field.

Properties: #access, #after_build, #ahah, #attributes, #cols (default: 60), #default_value, #description, #disabled, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #required, #resizable (default: TRUE), #rows (default: 5), #suffix, #theme, #title, #tree, #type, #weight

Usage example (forum.module):

<?php
$form
['body'] = array(
  '#type'
=> 'textarea',
  '#title'
=> t('Body'),
  '#default_value'
=> $node->body,
  '#required'
=> TRUE
);
?>

textfield

Description: Format a single-line text field.

Properties: #access, #after_build, #ahah, #attributes, #autocomplete_path (default: FALSE), #default_value, #description, #disabled, #element_validate, #field_prefix, #field_suffix, #maxlength (default: 128), #parents, #post_render, #prefix, #pre_render, #process, #required, #size (default: 60), #suffix, #theme, #title, #tree, #type, #weight

Usage example (forum.module):

<?php
$form
['title'] = array(
  '#type'
=> 'textfield',
  '#title'
=> t('Subject'),
  '#default_value'
=> $node->title,
  '#size'
=> 60,
  '#maxlength'
=> 128,
  '#required'
=> TRUE,
);
?>

token

Description: Store token data in a hidden form field (generally used to protect against cross-site forgeries). A token element is automatically added to each Drupal form by drupal_prepare_form(), so you don't generally have to add one yourself.

Properties: #access, #after_build, #default_value, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #suffix, #theme, #tree, #type, #value, #weight

value

Description: A form value that is internal to the form and never displayed to the screen.

Properties: #type, #value

Usage example (node.module):

<?php
$form
['vid'] = array('#type' => 'value', '#value' => $node->vid);
?>

Note that as of Drupal 6, you can also simply store arbitrary variables in $form['#foo'] instead, as long as '#foo' does not conflict with any other internal property of the Form API.

weight

Description: Format a weight selection menu.

Properties: #access, #after_build, #attributes, #default_value, #delta (default: 10), #description, #disabled, #element_validate, #parents, #post_render, #prefix, #pre_render, #process, #required, #suffix, #theme, #title, #tree, #type, #weight

Usage example (menu.module):

<?php
$form
['weight'] = array(
  '#type'
=> 'weight',
  '#title'
=> t('Weight'),
  '#default_value'
=> $edit['weight'],
  '#delta'
=> 10,
  '#description'
=> t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
);
?>

Properties

#access

Used by: All elements and forms

Description: Whether the element is accessible or not; when FALSE, the element is not rendered and the user submitted value is not taken into consideration.

Values: TRUE or FALSE.

#action

Used by: form

Description: The path to which the form will be submitted.

Values: An internal path

Usage example (comment.module):

<?php
$form
['#action'] = url('comment/reply/'. $edit['nid']);
?>

#after_build

Used by: All elements and forms

Description: An array of function names which will be called after the form or element is built.

Usage example (system.module):

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.

<?php
$form
['files']['file_directory_path'] = array(
  '#type' => 'textfield',
  '#title' => t('File system path'),
  '#default_value' => file_directory_path(),
  '#maxlength' => 255,
  '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
);

$form['#after_build'] = array('system_check_directory');

...

function
system_check_directory($form_element, &$form_state) {
  file_check_directory($form_element['#value'], FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
  return $form_element;
}

?>

#ahah

Used by: button, checkbox, hidden, image button, password, radio, select, submit, textarea, textfield

An array of elements whose values control the behavior of the element with respect to the Drupal AHAH javascript methods.

The #ahah name refers to AHAH javascript replacement (Asychronous HTML and HTTP), a relative of AJAX. AHAH is a form of javascript page replacement that is both easy and straight forward. In a nutshell an AHAH request follows these steps:

  1. Drupal builds a form element with a set of #ahah properties. The misc/ahah.js file is included on the page automatically.
  2. 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.
  3. 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'].
  4. 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.
  5. 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']

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.

Usage example (poll.module):

  $form['choice_wrapper']['poll_more'] = array(
   
'#type' => 'submit',
   
'#value' => t('More choices'),
   
'#description' => t("If the amount of boxes above isn't enough, click here to add more choices."),
   
'#weight' => 1,
   
'#submit' => array('poll_more_choices_submit'), // If no javascript action.
   
'#ahah' => array(
     
'path' => 'poll/js',
     
'wrapper' => 'poll-choices',
     
'method' => 'replace',
     
'effect' => 'fade',
    ),

#ahah['event']

Description: When this event occurs to this element, Drupal will perform an HTTP request in the background via Javascript.

Values: String. Possible values: Any valid jQuery event, including 'mousedown', 'blur', and '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.

#ahah['keypress']

Description: If set to TRUE, then the element's #ahah['event'] will be triggered if the ENTER key is pressed while the element has focus.

#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']

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;
}

...

function
_upload_form($node) {
  ...
   
$form['new']['attach'] = array(
     
'#type' => 'submit',
     
'#value' => t('Attach'),
     
'#name' => 'attach',
     
'#ahah' => array(
       
'path' => 'upload/js',
       
'wrapper' => 'attach-wrapper',
       
'progress' => array('type' => 'bar', 'message' => t('Please wait...')),
      ),
     
'#submit' => array('node_form_submit_build_node'),
    );
  ...
return
$form;
?>

#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', 'url', 'interval'

Possible values:

  • #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 'bar'.
  • #ahah['progress']['interval'] String. The interval to be used in updating the progress bar (as defined in progress.js). Ony used if 'url' is defined and 'type' is 'bar'.

Usage example: see above usage 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.

Usage example (upload.module):

    $form['new']['attach'] = array(
     
'#type' => 'submit',
     
'#value' => t('Attach'),
     
'#name' => 'attach',
     
'#ahah' => array(
       
'path' => 'upload/js',
       
'wrapper' => 'attach-wrapper',
       
'progress' => array('type' => 'bar', 'message' => t('Please wait...')),
      ),
     
'#submit' => array('node_form_submit_build_node'),
    );

#attributes

Used by: button, checkbox, checkboxes, date, fieldset, file, form, image_button, password, radio, radios, select, submit, textarea, textfield, weight

Description: Additional HTML attributes, such as 'class' can be set using this mechanism.

Values: Any HTML attribute not covered by other properties, e.g. class (for control types), enctype (for forms).

Usage example (search.module):

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.

<?php
$form
['#attributes'] = array('class' => 'search-form');
?>

#autocomplete_path

Used by: textfield

Description: The path the AJAX autocomplete script uses as the source for autocompletion.

Usage example (node.module):

<?php
$form
['author']['name'] = array(
  '#type'
=> 'textfield',
  '#title'
=> t('Authored by'),
  '#maxlength'
=> 60,
  '#autocomplete_path'
=> 'user/autocomplete',
  '#default_value'
=> $node->name,
  '#weight'
=> -1,
);
?>

#built

Used by: form

Description: Used to ascertain whether or not a form element has been built yet.

Values: TRUE or FALSE

Usage example: INTERNAL. See the _form_builder function in form.inc.

#button_type

Used by: button, image_button, submit

Description: Adds a CSS class to the button, in the form form-[button_type_value]. Note that this does NOT set the HTML attribute type of the button.

Values: String

Usage example: (system.module):

<?php
$type
['submit'] = array(
  '#input'
=> TRUE,
  '#name'
=> 'op',
  '#button_type'
=> 'submit',
  '#submit'
=> TRUE,
);
?>

#collapsed

Used by: fieldset

Description: Indicates whether or not the fieldset is collapsed by default. See #collapsible property.

Values: TRUE or FALSE

Usage example (block.module) :

<?php
$form
['block'] = array(
  '#type'
=> 'fieldset',
  '#title'
=> t('Block configuration'),
  '#weight'
=> 3,
  '#collapsible'
=> TRUE,
  '#collapsed'
=> FALSE,
  '#tree'
=> TRUE,
);
?>

#collapsible

Used by: fieldset

Description: Indicates whether or not the fieldset can be collapsed with JavaScript. See #collapsed property.

Values: TRUE or FALSE

Usage example (block.module):

<?php
$form
['block'] = array(
  '#type'
=> 'fieldset',
  '#title'
=> t('Block configuration'),
  '#weight'
=> 3,
  '#collapsible'
=> TRUE,
  '#collapsed'
=> FALSE,
  '#tree'
=> TRUE,
);
?>

#cols

Used by: textarea

Description: How many columns wide the textarea should be (see also #rows)

Values: A positive number

Usage example (aggregator.module):

<?php
$form
['description'] = array(
  
'#type' => 'textarea',
  '#title'
=> t('Description'),
  '#default_value'
=> $edit['description'],
  '#cols'
=> 60,
  '#rows'
=> 5,
);
?>

#default_value

Used by: checkbox, checkboxes, date, hidden, radio, radios, select, textarea, textfield, token, weight

Description: The value of the form element that will be displayed or selected initially if the form has not been submitted yet. Should NOT be confused with #value, which is a hard-coded value the user cannot change!

Values: Mixed

Usage example (forum.module):

<?php
$form
['body'] = array(
 
'#type' => 'textarea',
  '#title'
=> t('Body'),
  '#default_value'
=> $node->body,
  '#required'
=> TRUE,
);
?>

#delta

Used by: weight

Description: Number of weights to have selectable. For example, with $delta => 10, the weight selection box would display numbers from -10 to 10.

Values: A positive number

Usage example (menu.module):

<?php
$form
['weight'] = array(
  '#type'
=> 'weight',
  '#title'
=> t('Weight'),
  '#default_value'
=> $edit['weight'],
  '#delta'
=> 10,
  '#description'
=> t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
);
?>

#description

Used by: checkbox, checkboxes, date, fieldset, file, item, password, password_confirm, radio, radios, select, textarea, textfield, weight

Description: The description of the form element. Make sure to enclose inside the t() function so this property can be translated.

Values: Mixed

Usage example (menu.module):

<?php
$form
['weight'] = array(
  '#type'
=> 'weight',
  '#title'
=> t('Weight'),
  '#default_value'
=> $edit['weight'],
  '#delta'
=> 10,
  '#description'
=> t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
);
?>

#disabled

Used by: button, checkbox, checkboxes, date, file, image_button, password, password_confirm, radio, radios, select, submit, textarea, textfield, weight

Description: Disables (greys out) a form input element. Note that disabling a form field doesn't necessarily prevent someone from submitting a value through DOM manipulation. It just tells the browser not to accept input.

Values: TRUE or FALSE

Usage example (system.module):

<?php
     
if (isset($disabled[$name])) {
       
$form['theme_settings'][$name]['#disabled'] = TRUE;
      }
?>

#element_validate

Used by: any element

Description: A list of custom validation functions that need to be passed. The functions must use form_error() or form_set_error() to set an error if the validation fails.

Values: an array of function names to be called to validate this element (and/or its children).

A validation function for an element takes the element and the form state as parameters, and has the form:

function myelement_validate($element, &$form_state) {
   if (empty(
$element['#value'])) {
    
form_error($element, t('This field is required.'));
   }
}

Usage example (filter.module):

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.

<?php
 
if (count($formats) > 1) {
   
$form = array(
     
'#type' => 'fieldset',
     
'#title' => t('Input format'),
     
'#collapsible' => TRUE,
     
'#collapsed' => TRUE,
     
'#weight' => $weight,
     
'#element_validate' => array('filter_form_validate'),
    );
   ...
?>

#error

INTERNAL. Indicates whether or not a form element has been flagged as having an error.

#executes_submit_callback

Used by: button, image_button, submit

Description: Indicates whether or not the submit handler should be run when the form is submitted using this button element.

Values: TRUE or FALSE

#id

INTERNAL. Used to populate form elements' id property. In rare cases, you can set this value yourself on a form element, to override the default setting.

#input

INTERNAL. Indicates whether or not input is possible for this form element.

#field_prefix

Used by: textfield

Description: Text or code that is placed directly in front of the textfield. This can be used to prefix a textfield with a constant string.

Values: Mixed

Usage example (system.module):

<?php
$form
['site_403'] = array(
  
'#type' => 'textfield',
  
'#title' => t('Default 403 (access denied) page'),
  
'#default_value' => variable_get('site_403'''),
  
'#size' => 40,
  
'#description' => t('This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'),
  
'#field_prefix' => url(NULLNULLNULLTRUE) . (variable_get('clean_url'0) ? '' '?q=')
);
?>

#field_suffix

Used by: textfield

Description: Text or code that is placed directly after a textfield. This can be used to add a unit to a textfield.

Values: Mixed

Usage example (system.module):

<?php
$form
['settings_general']['upload_usersize_default'] = array(
  
'#type' => 'textfield',
  
'#title' => t('Default total file size per user'),
  
'#default_value' => $upload_usersize_default,
  
'#size' => 5,
  
'#maxlength' => 5,
  
'#description' => t('The default maximum size of all files a user can have on the site.'),
  
'#field_suffix' => t('MB')
);

#maxlength

Used by: password, textfield

Description: The maximum amount of characters to accept as input.

Values: A positive number.

Usage example (forum.module):

<?php
$form
['title'] = array(
 
'#type' => 'textfield',
  '#title'
=> t('Subject'),
  '#default_value'
=> $node->title,
  '#size'
=> 60,
  '#maxlength'
=> 128,
  '#required'
=> TRUE,
);
?>

#method

Used by: form

Description: The HTTP method with which the form will be submitted.

Values: GET or POST. Default is POST.

Usage example (node.module):

<?php
$form
['#method'] = 'post';
?>

#multiple

Used by: select

Description: Indicates whether the user may select more than one item.

Values: TRUE or FALSE

Usage example (taxonomy.module):

<?php
return array(
  '#type'
=> 'select',
  '#title'
=> $title,
  '#default_value'
=> $value,
  '#options'
=> $options,
  '#description'
=> $description,
  '#multiple'
=> $multiple,
  '#size'
=> $multiple ? min(12, count($options)) : 0,
  
'#weight' => -15,
);
?>

#name

Used by: button, submit

Description: INTERNAL, except for buttons. All button and submit elements on a form should have the same name, which is set to 'op' by default in Drupal. This does not apply to image buttons. For non-button elements, Drupal sets the name by using 'foo' in $form['foo'] as well as any parents of the element.

Values: String.

#options

Used by: checkboxes, radios, select

Description: Selectable options for a form element that allows multiple choices.

Values: An array in the form of array(t('Display value 1'), t('Display value 2')) or array('return_value1' => t('Display Value 1'), 'return_value2' => t('Display Value 2')) if specific return values are required.

Usage example (comment.module):

<?php
$form
['posting_settings']['comment_preview'] = array(
 
'#type' => 'radios',
  '#title'
=> t('Preview comment'),
  '#default_value'
=> variable_get('comment_preview', 1),
  '#options'
=> array(t('Optional'), t('Required')),
);
?>

#parents

Used by: All

Description: Identifies parent form elements. See #tree and #parents in the handbook.

Values: An array of element names.

Usage example (comment.module):

<?php
$form
['admin']['status'] = array(
 
'#type' => 'radios',
  '#parents'
=> array('status'),
  '#title'
=> t('Status'),
  '#default_value'
=> $status,
  '#options'
=> array(t('Published'), t('Not published')),
  '#weight'
=> -1,
);
?>

#post_render

Used by: All elements and forms

Description: Function(s) to call after rendering in drupal_render() has occured. The named function is called with two arguments, the rendered element and its children. It returns the (potentially) altered) element content.

Values: An array of function names to call.

Usage example:

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.

<?php
$form
['admin']['#post_render'] = array('admin_form_html_cleanup');
?>

This example would call admin_form_html_cleanup($content, $element) after $element has been rendered to $content via drupal_render(). $content may then be modified and must be returned.

#prefix

Used by: All elements and forms.

Description: Text or markup to include before the form element. Also see #suffix.

Values: Mixed

Usage example (poll.module):

<?php
$form
['choice'] = array(
  '#type'
=> 'fieldset',
  '#title'
=> t('Choices'),
  '#prefix'
=> '<div class="poll-form">',
  '#suffix'
=> '</div>',
  '#tree'
=> TRUE,
);
?>

#pre_render

Used by: All elements and forms.

Description: Function(s) to call before rendering in drupal_render() has occured. The function(s) provided in #pre_render receive the element as an argument and must return the altered element.

Values: An array of function names to call.

Usage example (filter.module):

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! As demonstrated here, you will probably want to add to the existing array rather than writing over it.

// Prepend #pre_render callback to replace field value with user notice
// prior to rendering.
if (!isset($element['value']['#pre_render'])) {
  $element['value']['#pre_render'] = array();
}
array_unshift($element['value']['#pre_render'], 'filter_form_access_denied');

...
function filter_form_access_denied($element) {
  $element['#value'] = t('This field has been disabled because you do not have sufficient permissions to edit it.');
  return $element;
}

This example would call filter_form_access_denied($element) before the $element has been rendered via drupal_render(). $element may then be modified and is returned for rendering.

#printed

INTERNAL. Used to determine whether or not a form element has been printed yet.

#process

Description: An array of functions that are called when an element is processed. Using this callback, modules can "register" further actions. For example the "radios" form type is expanded to multiple radio buttons using a processing function.

Values: Array of function names (strings)

Usage example (system.module) in system_elements():

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.

$type['radios'] = array('#input' => TRUE'#process' => array('expand_radios'));

In this example, the function expand_radios is called; the entire radios element is passed in as the argument. This function adds new elements of type radio to the existing radios element array, with keys and values corresponding to the processed element's #options.

#processed

INTERNAL. Used to ascertain whether or not a form element has been processed (ie: expanded to multiple elements).

#redirect

Used by: form

Description: The default goto value after form is submitted. This value should be returned by a form's submit callback function, but altering another form's #redirect value by using hook_form_alter() can be useful to change where that form redirects after it is submitted. Also see #action.

Values: An internal path or an array of arguments to pass to drupal_goto() (check that function's documentation for information on the arguments). The value may also be set to FALSE to prevent redirection after form submission.

Usage example (locale.inc):

<?php
$form
['#redirect'] = 'node';
?>

<?php
$form
['#redirect'] = array('user/login', 'destination=node&foo=bar');
?>

<?php
$form
['#redirect'] = FALSE;
?>

#required

Used by: checkbox, checkboxes, date, file, password, password_confirm, radio, radios, select, textarea, textfield, weight

Description: Indicates whether or not the element is required. This automatically validates for empty fields, and flags inputs as required. File fields are NOT allowed to be required.

Values: TRUE or FALSE

Usage example (forum.module):

<?php
$form
['title'] = array(
 
'#type' => 'textfield',
  '#title'
=> t('Subject'),
  '#default_value'
=> $node->title,
  '#size'
=> 60,
  '#maxlength'
=> 128,
  '#required'
=> TRUE,
);
?>

#resizable

Used by: textarea

Description: Whether users should be allowed to resize the text area

Values: TRUE or FALSE

#return_value

Used by: checkbox, image_button, radio

Description: Value element should return when selected

Values: Mixed

Usage example (poll.module):

<?php
$form
['morechoices'] = array(
  
'#type' => 'checkbox',
  '#title'
=> t('Need more choices'),
  '#return_value'
=> 1,
  '#default_value'
=> 0,
  '#description'
=> t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."),
);
?>

#rows

Used by: textarea

Description: How many rows high the textarea should be (see also #cols)

Values: A positive number

Usage example (aggregator.module):

<?php
$form
['description'] = array(
  
'#type' => 'textarea',
  '#title'
=> t('Description'),
  '#default_value'
=> $edit['description'],
  '#cols'
=> 60,
  '#rows'
=> 5,
);
?>

#size

Used by: file, password, password_confirm, select, textfield

Description: Width of the textfield (in characters) or size of multiselect box (in lines).

Values: A positive number.

Usage example (comment.module):

<?php
        $form
['admin']['homepage'] = array(
         
'#type' => 'textfield',
         
'#title' => t('Homepage'),
         
'#maxlength' => 255,
         
'#size' => 30,
         
'#default_value' => $edit['homepage'],
        );
?>

#src

Used by: image_button

Description: The URL of the image of the button.

Values: An URL.

#submit

Used by: button, form, image_button, submit

Description: Contains a list of submit callbacks to be excuted on the form or only when a specific button is clicked.

Values: An array of function names.

Usage example (menu.module):

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.

<?php
function menu_form_alter(&$form, $form_state, $form_id) {
   ... 
   
$form['menu']['parent'] = array(
     
'#type' => 'select',
     
'#title' => t('Parent item'),
     
'#default_value' => $default,
     
'#options' => $options,
     
'#attributes' => array('class' => 'menu-title-select'),
    );
   
$form['#submit'][] = 'menu_node_form_submit';
}
?>

Usage example (menu.module):

<?php
    $form
['menu_name'] = array('#type' => 'value', '#value' => $menu['menu_name']);
   
$form['#insert'] = FALSE;
   
$form['delete'] = array(
     
'#type' => 'submit',
     
'#value' => t('Delete'),
     
'#access' => !in_array($menu['menu_name'], menu_list_system_menus()),
     
'#submit' => array('menu_custom_delete_submit'),
     
'#weight' => 10,
    );
?>

#suffix

Used by: All elements and forms

Description: Text or markup to include after the form element. Also see #prefix.

Values: Mixed

Usage example (poll.module):

<?php
$form
['choice'] = array(
  '#type'
=> 'fieldset',
  '#title'
=> t('Choices'),
  '#prefix'
=> '<div class="poll-form">',
  '#suffix'
=> '</div>',
  '#tree'
=> TRUE,
);
?>

#theme

Used by: All elements and forms.

Description: Theme function to call for element.

Values: The name of a theme function, without the initial theme_.

Usage example (upload.module):

<?php
$form
['#theme'] = 'upload_form_new';
?>

#title

Used by: checkbox, checkboxes, date, fieldset, file, item, password, password_confirm, radio, radios, select, textarea, textfield, weight

Description: The title of the form element. Make sure to enclose inside the t() function so this property can be translated.

Values: Mixed

Usage example (aggregator.module):

<?php
$form
['description'] = array(
  
'#type' => 'textarea',
  '#title'
=> t('Description'),
  '#default_value'
=> $edit['description'],
  '#cols'
=> 60,
  '#rows'
=> 5,
);
?>

#tree

Used by: All

Description: Used to allow collections of form elements. Normally applied to the "parent" element, as the #tree property cascades to sub-elements. Use where you previously used ][ in form_ calls. For more information, see #tree and #parents in the handbook.

Values: TRUE or FALSE

Usage example (system.module):

<?php
$form
['status'] = array(
  '#type'
=> 'checkboxes',
  '#default_value'
=> $status,
  '#options'
=> $options,
  '#tree'
=> TRUE,
);
$required = array('block', 'filter', 'system', 'user', 'watchdog');
foreach (
$required as $require) {
  $form['status'][$require] = array(
    '#type'
=> 'hidden',
    '#value'
=> 1,
    '#suffix'
=> t('required'),
  );
}
?>

#type

Used by: All

Description: Used to determine the type of form element.

Values: button, checkbox, checkboxes, date, fieldset, file, form, hidden, image_button, item, markup, password, password_confirm, radio, radios, select, submit, textarea, textfield, token, value, weight

Usage example (locale.module):

<?php
$form
['submit'] = array('#type' => 'submit', '#value' => t('Import'));
?>

#validate

Used by: button, image_button, form, submit

Description: A list of custom validation functions that need to be passed.This is usually used to add additional validation functions to a form, or to use an alternate function rather than the default form validation function which is the form ID with _validate appended to it.

Values: An array of function names. Each such function will take $form and $form_state as parameters and should use form_set_error() if the form values do not pass validation. For example:

function test_form_validate($form, &$form_state) {
  if (
$form_state['values']['name'] == '') {
    
form_set_error('name', t('You must select a name for this group of settings.'));
  }
}

Usage example (node.module):

Note: If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.

<?php
   
// Node types:
   
$types = array_map('check_plain', node_get_types('names'));
   
$form['advanced']['type'] = array(
     
'#type' => 'checkboxes',
     
'#title' => t('Only of the type(s)'),
     
'#prefix' => '<div class="criterion">',
     
'#suffix' => '</div>',
     
'#options' => $types,
    );
   
$form['advanced']['submit'] = array(
     
'#type' => 'submit',
     
'#value' => t('Advanced search'),
     
'#prefix' => '<div class="action">',
     
'#suffix' => '</div>',
    );

   
$form['#validate'][] = 'node_search_validate';
?>

#validation_arguments

INTERNAL

#value

Used by: button, hidden, image_button, item, markup, submit, token, value

Description: Used to set values that cannot be edited by the user. Should NOT be confused with #default_value, which is for form inputs where users can override the default value.

Values: Mixed (text or numbers)

Usage example (locale.module):

<?php
$form
['submit'] = array('#type' => 'submit', '#value' => t('Import'));
?>

#weight

Used by: All elements

Description: Used to sort the list of form elements before being output; lower numbers appear before higher numbers.

Values: A positive or negative number (integer or decimal)

Usage example (book.module):

<?php
$form
['parent'] = array(
  '#type' => 'select',
  '#title'
=> t('Parent'),
  '#default_value'
=> ($node->parent ? $node->parent : arg(4)),
  '#options'
=> book_toc($node->nid),
  '#weight'
=> -15,
  
'#description' => t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.'),
);
?>

File

developer/topics/forms_api_reference.html
View source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>Form API Reference</title>
<style type="text/css">
/*<![CDATA[*/
h2 {
  border-bottom: 100% dashed 1px;
}
h3 {
  background-color: #dfedf7;
}
td {
  text-align: center;
}
.help {
  background-color: #ffc;
}
.x {
  background-color: #dfedf7;
}
.verified {
  background-color: #CFC;
}
.style1 {color: #0000bb}
.style2 {color: #dd0000}
.style3 {color: #007700}
.def-txt {color: #000000}
.r-txt {color: #DD0000}
.g-txt {color: #007700}
.b-txt {color: #0000BB}
.y-txt {color: #FF8000}
/*]]>*/
</style>
</head>

<body>
  <h1>Form API Reference</h1>
  <p>This document provides a programmer's reference to the Drupal Forms API. If you're interested in step-by-step documentation to help you write forms, please see the <a href="http://drupal.org/node/751826">Forms API QuickStart guide</a>.</p>
  <p>Skip to: <a href="#properties">Properties</a> | <a href="#element_default_values">Default Values</a> | <a href="#elements">Elements</a></p>

  <h2>Form Controls</h2>
  <p><strong>Legend:</strong><br />
  <strong>X</strong> = attribute can be used with this type<br />
  <strong>-</strong> = this attribute is not applicable to this type</p>
  <table border="1">
    <tr>
      <th scope="col"><a href="#type"><strong>#type</strong></a></th>
      <th scope="col"><a href="#checkbox">checkbox</a></th>
      <th scope="col"><a href="#checkboxes">checkboxes</a></th>
      <th scope="col"><a href="#date">date</a></th>
      <th scope="col"><a href="#fieldset">fieldset</a></th>
      <th scope="col"><a href="#file">file</a></th>
      <th scope="col"><a href="#password">password</a></th>
      <th scope="col"><a href="#password_confirm">password_confirm</a></th>
      <th scope="col"><a href="#radio">radio</a></th>
      <th scope="col"><a href="#radios">radios</a></th>
      <th scope="col"><a href="#select">select</a></th>
      <th scope="col"><a href="#textarea">textarea</a></th>
      <th scope="col"><a href="#textfield">textfield</a></th>
      <th scope="col"><a href="#weight">weight</a></th>
    </tr>
    <tr>
      <th scope="row"><a href="#access">#access</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#after_build">#after_build</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#ahah">#ahah</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#attributes">#attributes</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#autocomplete_path">#autocomplete_path</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#collapsed">#collapsed</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#collapsible">#collapsible</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#cols">#cols</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#default_value">#default_value</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#delta">#delta</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#description">#description</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#disabled">#disabled</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td><strong>-</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#element_validate">#element_validate</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#field_prefix">#field_prefix</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#field_suffix">#field_suffix</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#maxlength">#maxlength</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#multiple">#multiple</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#options">#options</a></th>
      <td>-</td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#parents">#parents</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#post_render">#post_render</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#prefix">#prefix</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#pre_render">#pre_render</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#process">#process</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#required">#required</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#resizable">#resizable</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#return_value">#return_value</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#rows">#rows</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td>-</td>  <!-- file -->
      <td>-</td>  <!-- password -->
      <td>-</td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td>-</td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td>-</td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#size">#size</a></th>
      <td>-</td>  <!-- checkbox -->
      <td>-</td>  <!-- checkboxes -->
      <td>-</td>  <!-- date -->
      <td>-</td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td>-</td>  <!-- radio -->
      <td>-</td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td>-</td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td>-</td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#suffix">#suffix</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#theme">#theme</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#title"><strong>#title</strong></a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#tree">#tree</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
    <tr>
      <th scope="row"><a href="#weightval">#weight</a></th>
      <td class="x"><strong>X</strong></td>  <!-- checkbox -->
      <td class="x"><strong>X</strong></td>  <!-- checkboxes -->
      <td class="x"><strong>X</strong></td>  <!-- date -->
      <td class="x"><strong>X</strong></td>  <!-- fieldset -->
      <td class="x"><strong>X</strong></td>  <!-- file -->
      <td class="x"><strong>X</strong></td>  <!-- password -->
      <td class="x"><strong>X</strong></td>  <!-- password_confirm -->
      <td class="x"><strong>X</strong></td>  <!-- radio -->
      <td class="x"><strong>X</strong></td>  <!-- radios -->
      <td class="x"><strong>X</strong></td>  <!-- select -->
      <td class="x"><strong>X</strong></td>  <!-- textarea -->
      <td class="x"><strong>X</strong></td>  <!-- textfield -->
      <td class="x"><strong>X</strong></td>  <!-- weight -->
    </tr>
  </table>

  <h2>Special Elements</h2>
  <table border="1">
    <tr>
      <th scope="col"><a href="#type">#</a><a href="#type">type</a></th>
      <th scope="col"><a href="#button">button</a></th>
      <th scope="col"><a href="#image_button">image_button</a></th>
      <th scope="col"><a href="#submit">submit</a></th>
      <th scope="col"><a href="#form">form</a></th>
      <th scope="col"><a href="#hidden">hidden</a></th>
      <th scope="col"><a href="#token">token</a></th>
      <th scope="col"><a href="#markup">markup</a></th>
      <th scope="col"><a href="#item">item</a></th>
      <th scope="col"><a href="#val">value</a></th>
    </tr>
    <tr>
      <th scope="row"><a href="#access">#access</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#action">#action</a></th>
      <td>-</td><!-- button -->
      <td>-</td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#after_build">#after_build</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#ahah">#ahah</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#attributes">#attributes</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#button_type">#button_type</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#default_value">#default_value</a></th>
      <td>-</td><!-- button -->
      <td>-</td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td>-</td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#description">#description</a></th>
      <td>-</td><!-- button -->
      <td>-</td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#disabled">#disabled</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#element_validate">#element_validate</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#executes_submit_callback">#executes_submit_callback</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#method">#method</a></th>
      <td>-</td><!-- button -->
      <td>-</td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#name">#name</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td>-</td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#parents">#parents</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#post_render">#post_render</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#prefix">#prefix</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#pre_render">#pre_render</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#process">#process</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#redirect">#redirect</a></th>
      <td>-</td><!-- button -->
      <td>-</td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#return_value">#return_value</a></th>
      <td>-</td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#src">#src</a></th>
      <td>-</td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#submit-prop">#submit</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#suffix">#suffix</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#theme">#theme</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#title"><strong>#title</strong></a></th>
      <td>-</td><!-- button -->
      <td>-</td><!-- image_button -->
      <td>-</td><!-- submit -->
      <td>-</td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#tree">#tree</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#validate">#validate</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td class="x"><strong>X</strong></td><!-- form -->
      <td>-</td><!-- hidden -->
      <td>-</td><!-- token -->
      <td>-</td><!-- markup -->
      <td>-</td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#value">#value</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td class="x"><strong>X</strong></td><!-- value -->
    </tr>
    <tr>
      <th scope="row"><a href="#weightval">#weight</a></th>
      <td class="x"><strong>X</strong></td><!-- button -->
      <td class="x"><strong>X</strong></td><!-- image_button -->
      <td class="x"><strong>X</strong></td><!-- submit -->
      <td>-</td><!-- form -->
      <td class="x"><strong>X</strong></td><!-- hidden -->
      <td class="x"><strong>X</strong></td><!-- token -->
      <td class="x"><strong>X</strong></td><!-- markup -->
      <td class="x"><strong>X</strong></td><!-- item -->
      <td>-</td><!-- value -->
    </tr>
  </table>

  <h2><a name="element_default_values" id="element_default_values"></a>Default Values</h2>
  <p>Every element automatically has these default values (see _element_info):</p>
  <ul>
    <li><a href="#description">#description</a> = NULL</li>
    <li><a href="#attributes">#attributes</a> = array()</li>
    <li><a href="#required">#required</a> = FALSE</li>
    <li><a href="#tree">#tree</a> = FALSE</li>
    <li><a href="#parents">#parents</a> = array()</li>
  </ul>
  <p>The following is a list of default values which do not need to be set (found in system_elements):</p>
  <ul>
    <li>
      <strong><a href="#button">button</a></strong>
      <ul>
        <li><a href="#name">#name</a> = 'op'</li>
        <li><a href="#button_type">#button_type</a> = 'submit'</li>
        <li><a href="#executes_submit_callback">#executes_submit_callback</a> = FALSE</li>
        <li><a href="#ahah_event">#ahah['event']</a> = 'mousedown' </li>
      </ul>
    </li>
    <li>
      <strong><a href="#checkbox">checkbox</a></strong>
      <ul>
        <li><a href="#return_value">#return_value</a> = 1</li>
        <li><a href="#ahah_event">#ahah['event']</a> = 'change' </li>
      </ul>
    </li>
    <li>
      <strong><a href="#checkboxes">checkboxes</a></strong>
      <ul>
        <li><a href="#tree">#tree</a> = TRUE</li>
      </ul>
    </li>
    <li>
      <a href="#fieldset"><strong>fieldset</strong></a>
      <ul>
        <li><a href="#collapsible">#collapsible</a> = FALSE</li>
        <li><a href="#collapsed">#collapsed</a> = FALSE</li>
      </ul>
    </li>
    <li>
      <strong><a href="#file">file</a></strong>
      <ul>
        <li><a href="#size">#size</a> = 60</li>
      </ul>
    </li>
    <li><strong><a href="#form">form</a></strong></li>
    <li style="list-style: none">
      <ul>
        <li><a href="#method">#method</a> = 'post'</li>
        <li><a href="#action">#action</a> = request_uri()</li>
      </ul>
    </li>
    <li>
      <strong><a href="#image_button">image_button</a></strong>
      <ul>
        <li><a href="#button_type">#button_type</a> = 'submit'</li>
        <li><a href="#executes_submit_callback">#executes_submit_callback</a> = TRUE</li>
        <li><a href="#ahah_event">#ahah['event']</a> = 'mousedown' </li>
      </ul>
    </li>
    <li><strong><a href="#radio">radio</a></strong></li>
    <li style="list-style: none">
      <ul>
        <li><a href="#ahah_event">#ahah['event']</a> = 'change' </li>
      </ul>
    </li>
    <li><strong><a href="#password">password</a></strong></li>
    <li style="list-style: none">
      <ul>
        <li><a href="#size">#size</a> = 60</li>
        <li><a href="#maxlength">#maxlength</a> = 128</li>
        <li><a href="#ahah_event">#ahah['event']</a> = 'blur' </li>
      </ul>
    </li>
    <li><strong><a href="#password_confirm">password_confirm</a></strong></li>
    <li style="list-style: none">
      <ul>
        <li><a href="#size">#size</a> = 60</li>
      </ul>
    </li>
    <li><strong><a href="#submit">submit</a></strong></li>
    <li style="list-style: none">
      <ul>
        <li><a href="#name">#name</a> = 'op'</li>
        <li><a href="#button_type">#button_type</a> = 'submit'</li>
        <li><a href="#executes_submit_callback">#executes_submit_callback</a> = TRUE</li>
        <li><a href="#ahah_event">#ahah['event']</a> = 'mousedown' </li>
      </ul>
    </li>
    <li>
      <strong><a href="#textarea">textarea</a></strong>
      <ul>
        <li><a href="#cols">#cols</a> = 60</li>
        <li><a href="#resizable">#resizable</a> = TRUE</li>
        <li><a href="#rows">#rows</a> = 5</li>
        <li><a href="#ahah_event">#ahah['event']</a> = 'blur' </li>
      </ul>
    </li>
    <li><strong><a href="#textfield">textfield</a></strong></li>
    <li style="list-style: none">
      <ul>
        <li><a href="#size">#size</a> = 60</li>
        <li><a href="#maxlength">#maxlength</a> = 128</li>
        <li><a href="#autocomplete_path">#autocomplete_path</a> = FALSE</li>
        <li><a href="#ahah_event">#ahah['event']</a> = 'blur' </li>
      </ul>
    </li>
    <li>
      <strong><a href="#weight">weight</a></strong>
      <ul>
        <li><a href="#delta">#delta</a> = 10</li>
      </ul>
    </li>
  </ul>

  <p>&nbsp;</p>

  <h2><a name="elements" id="elements"></a>Elements</h2>
  <p>Note that property names in <strong>bold</strong> are those that will generally need to be defined when creating this form element. Default values are indicated in parentheses next to property names, if they exist.</p>

  <h3><a name="button" id="button"></a>button</h3>
  <p><strong>Description</strong>: 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.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#button_type">#button_type</a> (default: submit), <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#executes_submit_callback">#executes_submit_callback</a> (default: FALSE), <a href="#name">#name</a> (default: op),  <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#submit-prop">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#validate">#validate</a>, <a href="#value"><strong>#value</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/node/node.module">node.module</a>):</p>
  <div class="codeblock">
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'preview'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'button'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Preview'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#weight'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">19,<br /></span><span class="g-txt">);<br /></span> <span class="b-txt">?&gt;</span></span></code></p>
  </div>

  <h3><a name="checkbox" id="checkbox"></a>checkbox</h3>
  <p><strong>Description</strong>: Format a checkbox.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#return_value"><strong>#return_value</strong></a> (default: 1), <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/contact/contact.module">contact.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'copy'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'checkbox'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt; t(</span><span class="r-txt">'Send me a copy.'</span><span class="g-txt">),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="checkboxes" id="checkboxes"></a>checkboxes</h3>
  <p><strong>Description</strong>: Format a set of checkboxes. #options is an associative array, where the key is the #return_value of the checkbox and the value is displayed. The #options array can not have a 0 key, as it would not be possible to discern checked and unchecked states.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#options"><strong>#options</strong></a>,  <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree"><strong>#tree</strong></a> (default: TRUE), <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/node/node.module">node.module</a>):</p>
  <div class="codeblock">
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'node_options_'</span><span class="g-txt">.</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">type</span><span class="g-txt">] = array(<br /></span></span></code> <code>&nbsp;&nbsp;<span class="def-txt"><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'checkboxes'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Default options'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">variable_get</span><span class="g-txt">(</span><span class="r-txt">'node_options_'</span><span class="g-txt">.</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">type,</span> <span class="g-txt">array(</span><span class="r-txt">'status'</span><span class="g-txt">,</span> <span class="r-txt">'promote'</span><span class="g-txt">)),<br /></span> &nbsp;&nbsp;<span class="r-txt">'#options'</span> <span class="g-txt">=&gt; array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp; 'status'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Published'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp;&nbsp;'moderate'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'In moderation queue'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp;&nbsp;'promote'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Promoted to front page'</span><span class="g-txt">),<br />
    &nbsp;&nbsp;&nbsp;&nbsp;</span><span class="r-txt">'sticky'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Sticky at top of lists'</span><span class="g-txt">),</span><span class="g-txt"><br />
    &nbsp;&nbsp;&nbsp;&nbsp;</span><span class="r-txt">'revision'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Create new revision'</span><span class="g-txt">)</span>,<span class="g-txt"><br />
    &nbsp;&nbsp;),</span><span class="g-txt"><br /></span> &nbsp;&nbsp;<span class="r-txt">'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Users with the &lt;em&gt;administer nodes&lt;/em&gt; permission will be able to override these options.'</span><span class="g-txt">),<br />
    );<br /></span> <span class="b-txt">?&gt;</span></span></code></p>
  </div>

  <h3><a name="date" id="date"></a>date</h3>
  <p><strong>Description</strong>: Format a date selection box. The #default_value will be today's date if no value is supplied. The format for the #default_value and the #return_value is an array with three elements with the keys: 'year', month', and 'day'. For example, <code><span class="g-txt">array(</span><span class="r-txt">'year'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">2007</span><span class="g-txt">,</span> <span class="r-txt">'month'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">2</span><span class="g-txt">,</span> <span class="r-txt">'day'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">15</span><span class="g-txt">)</span></code></p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/profile/profile.module">profile.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $fields</span><span class="g-txt">[</span><span class="b-txt">$category</span><span class="g-txt">][</span><span class="b-txt">$field</span><span class="g-txt">-&gt;</span><span class="b-txt">name</span><span class="g-txt">] = array(<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'date'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">check_plain</span><span class="g-txt">(</span><span class="b-txt">$field</span><span class="g-txt">-&gt;</span><span class="b-txt">title</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="b-txt">$field</span><span class="g-txt">-&gt;</span><span class="b-txt">name</span><span class="g-txt">],</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">_profile_form_explanation</span><span class="g-txt">(</span><span class="b-txt">$field</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#required'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$field</span><span class="g-txt">-&gt;</span><span class="b-txt">required<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="fieldset" id="fieldset"></a>fieldset</h3>
  <p><strong>Description</strong>: Format a group of form items.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#attributes">#attributes</a>, <a href="#collapsed"><strong>#collapsed</strong></a> (default: FALSE), <a href="#collapsible"><strong>#collapsible</strong></a> (default: FALSE), <a href="#description">#description</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/contact/contact.module">contact.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'contact'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'fieldset'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Contact settings'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#weight'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">5</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#collapsible'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#collapsed'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">FALSE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="file" id="file"></a>file</h3>
  <p><strong>Description</strong>: Format a file upload field.</p>
  <p>Note: you will need to include <code>$form['#attributes'] = array('enctype' =&gt; "multipart/form-data");</code> in your form. See this handbook page for an example <a href="http://drupal.org/node/111782">http://drupal.org/node/111782</a>.</p>
  <p>Note: the #required property is not supported (setting it to true will always cause a validation error). Instead, you may want to use your own validation function to do checks on the $_FILES array with #required set to false. You will also have to add your own required asterisk if you would like one.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#attributes">#attributes</a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#size"><strong>#size</strong></a> (default: 60), <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/upload/upload.module">upload.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'new'</span><span class="g-txt">][</span><span class="r-txt">'upload'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'file'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Attach new file'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">40,<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="form" id="form"></a>form</h3>
  <p><strong>Description</strong>: A form containing form elements</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#action">#action</a> (default: request_uri()), <a href="#after_build">#after_build</a>, <a href="#attributes">#attributes</a>, <a href="#method">#method</a> (default: 'post'),  <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#redirect">#redirect</a>, <a href="#submit-prop">#submit</a>, <a href="#suffix">#suffix</a>,  <a href="#theme">#theme</a>, <a href="#tree">#tree</a>, <a href="#validate">#validate</a></p>
  <p><strong>Usage example</strong>:</p>
  <p class="help">N/A</p>

  <h3><a name="hidden" id="hidden"></a>hidden</h3>
  <p><strong>Description</strong>: Store data in a hidden form field.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#default_value">#default_value</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#value"><strong>#value</strong></a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/block/block.module">block.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'bid'</span><span class="g-txt">] = array(</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'hidden'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$bid</span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>
  <p>Note that if you plan to use JavaScript to change your <code>hidden</code> element's value, you will need to use the <code>#default_value</code> property rather than <code>#value</code>.</p>

  <h3><a name="image_button" id="image_button"></a>image_button</h3>
  <p><strong>Description</strong>: Format a form submit button with an image. Note: using multiple image_buttons with #value set will make the submission think the last defined was the $form_state['clicked_button'].</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#button_type">#button_type</a> (default: 'submit'), <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#executes_submit_callback">#executes_submit_callback</a> (default: TRUE), <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#return_value">#return_value</a> (default: TRUE), <a href="#src">#src</a>, <a href="#submit-prop">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#validate">#validate</a>, <a href="#value"><strong>#value</strong></a>, <a href="#weightval">#weight</a></p>

  <h3><a name="item" id="item"></a>item</h3>
  <p><strong>Description</strong>: Generate a display-only form element allowing for an optional title and description.</p>
  <p>Note: since this is a read-only field, setting the <a href="#required">#required</a> property will do nothing except theme the form element to look as if it were actually required (i.e. by placing a red star next to the <a href="#title">#title</a>).</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#description">#description</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#required">#required</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#value"><strong>#value</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/head/file/modules/contact.module">contact.module</a>):</p>
  <div class="codeblock">
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br /></span></span></code> <span class="style1"><code>$form[<span class="style2">'from'</span>] = <span class="style3">array(</span><br />
    &nbsp;&nbsp;</code><code><span class="style2">'#type'</span> =&gt; <span class="style2">'item'</span>,<br />
    &nbsp; <span class="style2">'#title'</span> =&gt; t(<span class="style2">'From'</span>),<br />
    &nbsp; <span class="style2">'#value'</span> =&gt; $user-&gt;name .<span class="style2">' &amp;lt;'</span>. $user-&gt;mail .<span class="style2">'&amp;gt;'</span>,<br />
    <span class="style3">);</span></code></span><code><span class="def-txt"><span class="g-txt"><br /></span> <span class="b-txt">?&gt;</span></span></code></p>
  </div>

  <h3><a name="markup" id="markup"></a>markup</h3>
  <p><strong>Description</strong>: Generate generic markup for display inside forms. Note that there is <strong>no need to declare a form element as #type = 'markup'</strong>, as this is the default type.</p>
  <p>Note: if you use markup, if your content is not wrapped in tags (generally &lt;p&gt; or &lt;div&gt;), your content will fall outside of collapsed fieldsets.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#tree">#tree</a>, <a href="#type">#type</a>, <a href="#value"><strong>#value</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/contact/contact.module">contact.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'contact_information'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">variable_get</span><span class="g-txt">(</span><span class="r-txt">'contact_form_information'</span><span class="g-txt">,</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'You can leave us a message using the contact form below.'</span><span class="g-txt">)),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="password" id="password"></a>password</h3>
  <p><strong>Description</strong>: Format a single-line text field that does not display its contents visibly.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#maxlength"><strong>#maxlength</strong></a> (default: 128),  <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#size"><strong>#size</strong></a> (default: 60), <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/user/user.module">user.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'pass'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'password'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Password'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#maxlength'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">64</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">15</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="password_confirm" id="password_confirm"></a>password_confirm</h3>
  <p><strong>Description</strong>: Format a pair of <a href="#password">password</a> fields, which do not validate unless the two entered passwords match.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#size"><strong>#size</strong></a> (default: 60), <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/user/user.module">user.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'pass'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'password_confirm'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Password'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">25</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="radio" id="radio"></a>radio</h3>
  <p><strong>Description</strong>: Format a radio button.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#return_value">#return_value</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong>:</p>
  <p class="help">N/A</p>

  <h3><a name="radios" id="radios"></a>radios</h3>
  <p><strong>Description</strong>: Format a set of radio buttons.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#options"><strong>#options</strong></a>,  <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/system/system.module">comment.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'posting_settings'</span><span class="g-txt">][</span><span class="r-txt">'comment_preview'</span><span class="g-txt">] = array(<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'radios'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Preview comment'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">variable_get</span><span class="g-txt">(</span><span class="r-txt">'comment_preview'</span><span class="g-txt">,</span> <span class="b-txt">1</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#options'</span> <span class="g-txt">=&gt; array(</span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Optional'</span><span class="g-txt">),</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Required'</span><span class="g-txt">)),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="select" id="select"></a>select</h3>
  <p><strong>Description</strong>: Format a drop-down menu or scrolling selection box.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#multiple"><strong>#multiple</strong></a>, <a href="#options"><strong>#options</strong></a>,  <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#size">#size</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/system/system.module">system.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'feed'</span><span class="g-txt">][</span><span class="r-txt">'feed_item_length'</span><span class="g-txt">] = array(<br /></span> <span class="r-txt">&nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'select'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Display of XML feed items'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">variable_get</span><span class="g-txt">(</span><span class="r-txt">'feed_item_length'</span><span class="g-txt">,</span><span class="r-txt">'teaser'</span><span class="g-txt">),<br /></span> <span class="r-txt">&nbsp;&nbsp;'#options'</span> <span class="g-txt">=&gt; array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp; 'title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Titles only'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp; 'teaser'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Titles plus teaser'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp;&nbsp;'fulltext'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Full text'</span><span class="g-txt">),<br />
    &nbsp;&nbsp;),<br /></span> <span class="r-txt">&nbsp;&nbsp;'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Global setting for the length of XML feed items that are output by default.'</span><span class="g-txt">),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="submit" id="submit"></a>submit</h3>
  <p><strong>Description</strong>: Format a form submit button.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#button_type">#button_type</a> (default: 'submit'), <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#executes_submit_callback">#executes_submit_callback</a> (default: TRUE), <a href="#name">#name</a> (default: 'op'),  <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#submit-prop">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#validate">#validate</a>, <a href="#value"><strong>#value</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/locale/locale.module">locale.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'submit'</span><span class="g-txt">] = array(</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'submit'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Import'</span><span class="g-txt">));<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="textarea" id="textarea"></a>textarea</h3>
  <p><strong>Description</strong>: Format a multiple-line text field.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#cols"><strong>#cols</strong></a> (default: 60), <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#resizable">#resizable</a> (default: TRUE), <a href="#rows"><strong>#rows</strong></a> (default: 5), <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/forum/forum.module">forum.module</a>):</p>
  <div class="codeblock">
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'body'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textarea'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Body'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">body</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#required'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE<br /></span></span></code><code><span class="def-txt"><span class="g-txt">);<br /></span> <span class="b-txt">?&gt;</span></span></code></p>
  </div>

  <h3><a name="textfield" id="textfield"></a>textfield</h3>
  <p><strong>Description</strong>: Format a single-line text field.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#autocomplete_path">#autocomplete_path</a> (default: FALSE), <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#field_prefix">#field_prefix</a>, <a href="#field_suffix">#field_suffix</a>, <a href="#maxlength"><strong>#maxlength</strong></a> (default: 128),  <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#size"><strong>#size</strong></a> (default: 60), <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/forum/forum.module">forum.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'title'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textfield'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Subject'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">title</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#maxlength'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">128</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#required'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="token" id="token"></a>token</h3>
  <p><strong>Description</strong>: Store token data in a hidden form field (generally used to protect against cross-site forgeries). A token element is automatically added to each Drupal form by drupal_prepare_form(), so you don't generally have to add one yourself.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#default_value">#default_value</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#value"><strong>#value</strong></a>, <a href="#weightval">#weight</a></p>

  <h3><a name="val" id="val"></a>value</h3>
  <p><strong>Description</strong>: A form value that is internal to the form and never displayed to the screen.</p>
  <p><strong>Properties</strong>: <a href="#type"><strong>#type</strong></a>, <a href="#value"><strong>#value</strong></a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/node/node.module">node.module</a>):</p>
  <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />
  $form</span><span class="g-txt">[</span><span class="r-txt">'vid'</span><span class="g-txt">] =</span> <span class="b-txt">array</span><span class="g-txt">(</span><span class="r-txt">'#type'</span> =&gt; <span class="r-txt">'value'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$node-&gt;vid</span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code></p>
<p>Note that as of Drupal 6, you can also simply store arbitrary variables in <code>$form['#foo']</code> instead, as long as <code>'#foo'</code> does not conflict with any other internal property of the Form API.</p>

  <h3><a name="weight" id="weight"></a>weight</h3>
  <p><strong>Description</strong>: Format a weight selection menu.</p>
  <p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#delta"><strong>#delta</strong></a> (default: 10), <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#parents">#parents</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#title"><strong>#title</strong></a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/menu/menu.module">menu.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'weight'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'weight'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Weight'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'weight'</span><span class="g-txt">],</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#delta'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">10</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'</span><span class="g-txt">),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h2><a name="properties" id="properties"></a>Properties</h2>

  <h3><a name="access" id="access"></a>#access</h3>
  <p><strong>Used by</strong>: All elements and forms</p>
  <p><strong>Description</strong>: Whether the element is accessible or not; when FALSE, the element is not rendered and the user submitted value is not taken into consideration.</p>
  <p><strong>Values</strong>: TRUE or FALSE.</p>

  <h3><a name="action" id="action"></a>#action</h3>
  <p><strong>Used by</strong>: <a href="#form">form</a></p>
  <p><strong>Description</strong>: The path to which the form will be submitted.</p>
  <p><strong>Values</strong>: An internal path</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/comment/comment.module">comment.module</a>):</p>
  <div class="codeblock">
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'#action'</span><span class="g-txt">] =</span> <span class="b-txt">url</span><span class="g-txt">(</span><span class="r-txt">'comment/reply/'</span><span class="g-txt">.</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'nid'</span><span class="g-txt">]);<br /></span> <span class="b-txt">?&gt;</span></span></code></p>
  </div>

  <h3><a name="after_build" id="after_build"></a>#after_build</h3>
  <p><strong>Used by</strong>: All elements and forms</p>
  <p><strong>Description</strong>: An array of function names which will be called after the form or element is built.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/system/system.module">system.module</a>):</p>
<p><strong>Note:</strong> If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.</p>
  <div class="codeblock">
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'files'</span><span class="g-txt">][</span><span class="r-txt">'file_directory_path'</span><span class="g-txt">] = array(<br /></span> <span class="r-txt">&nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textfield'</span><span class="g-txt">,<br /></span> <span class="r-txt"><code><span class="def-txt"><span class="r-txt">&nbsp;&nbsp;</span></span></code>'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'File system path'</span><span class="g-txt">),<br /></span> <span class="r-txt"><code><span class="def-txt"><span class="r-txt">&nbsp;&nbsp;</span></span></code>'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">file_directory_path</span><span class="g-txt">(),<br /></span> <span class="r-txt"><code><span class="def-txt"><span class="r-txt">&nbsp;&nbsp;</span></span></code>'#maxlength'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">255</span><span class="g-txt">,<br /></span> <span class="r-txt"><code><span class="def-txt"><span class="r-txt">&nbsp;&nbsp;</span></span></code>'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'</span><span class="g-txt">),<br />
    );</span><br />
    <span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'#after_build'</span><span class="g-txt">] = array(<span class="r-txt">'system_check_directory'</span>);</span><br /></span></code></p>
    <p><code><span class="def-txt"><span class="g-txt">...<br />
    <br />
    function</span> <span class="b-txt">system_check_directory</span><span class="g-txt">(</span><span class="b-txt">$form_element</span><span class="g-txt">,</span> <span class="b-txt">&amp;$form_state</span><span class="g-txt">) {<br /></span> <span class="b-txt">&nbsp;&nbsp;file_check_directory</span><span class="g-txt">(</span><span class="b-txt">$form_element</span><span class="g-txt">[</span><span class="r-txt">'#value'</span><span class="g-txt">],</span> <span class="b-txt">FILE_CREATE_DIRECTORY</span><span class="g-txt">,</span> <span class="b-txt">$form_element</span><span class="g-txt">[</span><span class="r-txt">'#parents'</span><span class="g-txt">][</span><span class="b-txt">0</span><span class="g-txt">]);<br /></span> <span class="b-txt">&nbsp;&nbsp;</span><span class="g-txt">return</span> <span class="b-txt">$form_element</span><span class="g-txt">;<br />
    }</span><span class="g-txt"><br /></span> <span class="b-txt">?&gt;</span></span></code></p>
  </div>

  <h3><a name="ahah" id="ahah"></a>#ahah</h3>
  <p><strong>Used by</strong>:
    <a href="#button">button</a>,
    <a href="#checkbox">checkbox</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="#select">select</a>,
    <a href="#submit">submit</a>,
    <a href="#textarea">textarea</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 AHAH javascript methods.</p>
  <p>The #ahah name refers to <a href="http://en.wikipedia.org/wiki/AHAH">AHAH javascript replacement</a> (Asychronous HTML and HTTP), a relative of AJAX.
    AHAH is a form of javascript page replacement that is both easy and straight forward. In a nutshell an AHAH request follows these steps:</p>
  <ol>
    <li>Drupal builds a form element with a set of #ahah properties. The <code>misc/ahah.js</code> 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 'click'), 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. While the user waits for the callback to execute a throbber or progress bar is shown as determined by <a href="#ahah_progress">#ahah['progress']</a>. 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>
  <h3><a name="ahah_effect" id="ahah_effect"></a>#ahah['effect']</h3>

  <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>
   <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/poll/poll.module/">poll.module</a>):</p>

    <div class="codeblock"><code><span style="color: #000000"><span style="color: #0000BB">&nbsp; $form</span><span style="color: #007700">[</span><span style="color: #DD0000">'choice_wrapper'</span><span style="color: #007700">][</span><span style="color: #DD0000">'poll_more'</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">'submit'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'More choices'</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">"If the amount of boxes above isn't enough, click here to add more choices."</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#weight' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#submit' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'poll_more_choices_submit'</span><span style="color: #007700">), </span><span style="color: #FF8000">// If no javascript action.<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#ahah' </span><span style="color: #007700">=&gt; array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'path' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'poll/js'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'wrapper' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'poll-choices'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'method' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'replace'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'effect' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'fade'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp; ),<br /></span></span></code></div>

   <h3><a name="ahah_event" id="ahah_event"></a>#ahah['event']</h3>

  <p><strong>Description</strong>: When this event occurs to this element, Drupal will perform an HTTP request in the background via Javascript.</p>

  <p><strong>Values</strong>: String. Possible values: Any valid <a href="http://docs.jquery.com/Events">jQuery event</a>, including 'mousedown', 'blur', and 'change'.
  Note that #ahah['event'] does not need to be explicitly specified. Although it can be manually set, usually the <a href="#element_default_values">default value </a> will be sufficient.</p>

  <h3><a name="ahah_keypress" id="ahah_keypress"></a>#ahah['keypress']</h3>
  
  <p><strong>Description</strong>: If set to TRUE, then the element's #ahah['event'] will be triggered if the ENTER key is pressed while the element has focus.</p>

  <h3><a name="ahah_method" id="ahah_method"></a>#ahah['method']</h3>
  <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>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/file/modules/upload/upload.module">upload.module</a>):</p>

  <div class="codeblock"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/**<br />* Implementation of hook_menu().<br />*/<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">upload_menu</span><span style="color: #007700">() {<br />&nbsp; </span><span style="color: #0000BB">$items</span><span style="color: #007700">[</span><span style="color: #DD0000">'upload/js'</span><span style="color: #007700">] = array(<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'page callback' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'upload_js'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'access arguments' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'upload files'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'type' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">MENU_CALLBACK</span><span style="color: #007700">,<br />&nbsp; );<br />&nbsp; ...<br />&nbsp; return </span><span style="color: #0000BB">$items</span><span style="color: #007700">;<br />}<br /><br />...<br /><br />function </span><span style="color: #0000BB">_upload_form</span><span style="color: #007700">(</span><span style="color: #0000BB">$node</span><span style="color: #007700">) {<br />&nbsp; ...<br />&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'new'</span><span style="color: #007700">][</span><span style="color: #DD0000">'attach'</span><span style="color: #007700">] = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'submit'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Attach'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#name' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'attach'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#ahah' </span><span style="color: #007700">=&gt; array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'path' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'upload/js'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'wrapper' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'attach-wrapper'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'progress' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">, </span><span style="color: #DD0000">'message' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Please wait...'</span><span style="color: #007700">)),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#submit' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'node_form_submit_build_node'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp; );<br />&nbsp; ...<br />return </span><span style="color: #0000BB">$form</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></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_progress" id="ahah_progress"></a>#ahah['progress']</h3>

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

  <p><strong>Values</strong>: Array.</p>
  <p>Possible keys: 'type', 'message', 'url', 'interval'</p>
  <p>Possible values:</p>
  <ul>
    <li><strong>#ahah['progress']['type']</strong> String. Possible values: 'throbber' (default), 'bar'.
    </li>
    <li><strong>#ahah['progress']['message']</strong> String.  An optional message to the user; should be wrapped with t().
    </li>
    <li><strong>#ahah['progress']['url']</strong> 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 'bar'.
    </li>
    <li><strong>#ahah['progress']['interval']</strong> String. The interval to be used in updating the progress bar (as defined in progress.js).  Ony used if 'url' is defined and 'type' is 'bar'.
    </li>
  </ul>

  <p><strong>Usage example</strong>: see <a href="#ahah_path">above usage</a> in upload.module</p>

  <h3><a name="ahah_wrapper" id="ahah_wrapper"></a>#ahah['wrapper']</h3>
  <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/file/modules/upload/upload.module">upload.module</a>):</p>

  <div class="codeblock"><code><span style="color: #000000"><span style="color: #0000BB">&nbsp;&nbsp;&nbsp; $form</span><span style="color: #007700">[</span><span style="color: #DD0000">'new'</span><span style="color: #007700">][</span><span style="color: #DD0000">'attach'</span><span style="color: #007700">] = array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'submit'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Attach'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#name' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'attach'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#ahah' </span><span style="color: #007700">=&gt; array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'path' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'upload/js'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'wrapper' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'attach-wrapper'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'progress' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">, </span><span style="color: #DD0000">'message' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Please wait...'</span><span style="color: #007700">)),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#submit' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'node_form_submit_build_node'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp; );<br /></span></span></code></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="#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="#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>
  <p><strong>Values</strong>: Any HTML attribute not covered by other properties, e.g. <strong>class</strong> (for control types), <strong>enctype</strong> (for forms).</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/search/search.module">search.module</a>):</p>
<p><strong>Note:</strong> If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'#attributes'</span><span class="g-txt">] = array(</span><span class="r-txt">'class'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'search-form'</span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="autocomplete_path" id="autocomplete_path"></a>#autocomplete_path</h3>
  <p><strong>Used by</strong>: <a href="#textfield">textfield</a></p>
  <p><strong>Description</strong>: The path the AJAX autocomplete script uses as the source for autocompletion.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/node/node.module">node.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'author'</span><span class="g-txt">][</span><span class="r-txt">'name'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textfield'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Authored by'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#maxlength'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#autocomplete_path'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'user/autocomplete'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">name</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#weight'</span> <span class="g-txt">=&gt; -</span><span class="b-txt">1,<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="built" id="built"></a>#built</h3>
  <p><strong>Used by</strong>: <a href="#form">form</a></p>
  <p><strong>Description</strong>: Used to ascertain whether or not a form element has been built yet.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>
  <p><strong>Usage example</strong>: INTERNAL. See the <a href="http://api.drupal.org/api/function/_form_builder">_form_builder</a> function in <a href="http://api.drupal.org/api/file/includes/form.inc">form.inc</a>.</p>

  <h3><a name="button_type" id="button_type"></a>#button_type</h3>
  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#image_button">image_button</a>, <a href="#submit">submit</a></p>
  <p><strong>Description</strong>: Adds a CSS class to the button, in the form <em>form-[button_type_value]</em>. Note that this does NOT set the HTML attribute <em>type</em> of the button.</p>
  <p class="help"><strong>Values</strong>: String </p>
  <p><strong>Usage example</strong>: (<a href="http://api.drupal.org/api/file/modules/system/system.module">system.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $type</span><span class="g-txt">[</span><span class="r-txt">'submit'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#input'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#name'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'op'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#button_type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'submit'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#submit'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE,<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="collapsed" id="collapsed"></a>#collapsed</h3>
  <p><strong>Used by</strong>: <a href="#fieldset">fieldset</a></p>
  <p><strong>Description</strong>: Indicates whether or not the fieldset is collapsed by default. See <a href="#collapsible">#collapsible</a> property.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/block/block.module">block.module</a>) :</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'block'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'fieldset'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Block configuration'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#weight'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">3</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#collapsible'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#collapsed'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">FALSE</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#tree'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="collapsible" id="collapsible"></a>#collapsible</h3>
  <p><strong>Used by</strong>: <a href="#fieldset">fieldset</a></p>
  <p><strong>Description</strong>: Indicates whether or not the fieldset can be collapsed with JavaScript. See <a href="#collapsed">#collapsed</a> property.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/block/block.module">block.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'block'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'fieldset'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Block configuration'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#weight'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">3</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#collapsible'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#collapsed'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">FALSE</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#tree'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="cols" id="cols"></a>#cols</h3>
  <p><strong>Used by</strong>: <a href="#textarea">textarea</a></p>
  <p><strong>Description</strong>: How many columns wide the textarea should be (see also <a href="#rows">#rows</a>)</p>
  <p><strong>Values</strong>: A positive number</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/aggregator/aggregator.module">aggregator.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">] = array(<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textarea'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Description'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">],</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#cols'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#rows'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">5</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="default_value" id="default_value"></a>#default_value</h3>
  <p><strong>Used by</strong>: <a href="#checkbox">checkbox</a>, <a href="#checkboxes">checkboxes</a>, <a href="#date">date</a>, <a href="#hidden">hidden</a>, <a href="#radio">radio</a>, <a href="#radios">radios</a>, <a href="#select">select</a>, <a href="#textarea">textarea</a>, <a href="#textfield">textfield</a>, <a href="#token">token</a>, <a href="#weight">weight</a></p>
  <p><strong>Description</strong>: The value of the form element that will be displayed or selected initially if the form has not been submitted yet. <strong>Should NOT be confused with</strong> <strong><a href="#value">#value</a></strong>, which is a hard-coded value the user cannot change!</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/forum/forum.module">forum.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'body'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textarea'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Body'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">body</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#required'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="delta" id="delta"></a>#delta</h3>
  <p><strong>Used by</strong>: <a href="#weight">weight</a></p>
  <p><strong>Description</strong>: Number of weights to have selectable. For example, with $delta =&gt; 10, the weight selection box would display numbers from -10 to 10.</p>
  <p><strong>Values</strong>: A positive number</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/menu/menu.module">menu.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'weight'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'weight'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Weight'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'weight'</span><span class="g-txt">],</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#delta'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">10</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'</span><span class="g-txt">),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="description" id="description"></a>#description</h3>
  <p><strong>Used by</strong>: <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="#item">item</a>, <a href="#password">password</a>, <a href="#password_confirm">password_confirm</a>, <a href="#radio">radio</a>, <a href="#radios">radios</a>, <a href="#select">select</a>, <a href="#textarea">textarea</a>, <a href="#textfield">textfield</a>, <a href="#weight">weight</a></p>
  <p><strong>Description</strong>: The description of the form element. Make sure to enclose inside the <a href="http://api.drupal.org/api/function/t">t</a>() function so this property can be translated.</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/menu/menu.module">menu.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'weight'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'weight'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Weight'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'weight'</span><span class="g-txt">],</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#delta'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">10</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'</span><span class="g-txt">),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="disabled" id="disabled"></a>#disabled</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="#file">file</a>, <a href="#image_button">image_button</a>, <a href="#password">password</a>, <a href="#password_confirm">password_confirm</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>: Disables (greys out) a form input element. Note that disabling a form field doesn't necessarily prevent someone from submitting a value through DOM manipulation. It just tells the browser not to accept input.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/system/system.module">system.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    &nbsp; &nbsp; &nbsp;</span> <span class="g-txt">if&nbsp;(isset(</span><span class="b-txt">$disabled</span><span class="g-txt">[</span><span class="b-txt">$name</span><span class="g-txt">]))&nbsp;{<br />
    &nbsp; &nbsp; &nbsp; &nbsp;</span> <span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'theme_settings'</span><span class="g-txt">][</span><span class="b-txt">$name</span><span class="g-txt">][</span><span class="r-txt">'#disabled'</span><span class="g-txt">]&nbsp;=&nbsp;</span><span class="b-txt">TRUE</span><span class="g-txt">;<br />
    &nbsp; &nbsp; &nbsp; }<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="element_validate" id="element_validate"></a>#element_validate</h3>
  <p class="help"><strong>Used by</strong>: any element</p>
  <p><strong>Description</strong>: A list of custom validation functions that need to be passed. The functions must use form_error() or form_set_error() to set an error if the validation fails.</p>
  <p><strong>Values</strong>: an array of function names to be called to validate this element (and/or its children).</p>
  <p>A validation function for an element takes the element and the form state as parameters, and has the form:</p>
  <div class="codeblock">
    <code>
      <span style="color: #007700">function </span><span style="color: #0000BB">myelement_validate</span><span style="color: #007700">(</span><span style="color: #0000BB">$element</span><span style="color: #007700">, &amp;</span><span style="color: #0000BB">$form_state</span><span style="color: #007700">) {<br />
      &nbsp;&nbsp; if (empty(</span><span style="color: #0000BB">$element</span><span style="color: #007700">[</span><span style="color: #DD0000">'#value'</span><span style="color: #007700">])) {<br />
      &nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">form_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$element</span><span style="color: #007700">, </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'This field is required.'</span><span style="color: #007700">));<br />
      &nbsp;&nbsp; }<br />
      }<br /></span>
    </code>
  </div>

  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/filter/filter.module/">filter.module</a>):</p>
<p><strong>Note:</strong> If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.</p>
  <div class="codeblock">
    <code>
      <span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
      &nbsp; </span><span style="color: #007700">if (</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$formats</span><span style="color: #007700">) &gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">) {<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form </span><span style="color: #007700">= array(<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'fieldset'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&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">'Input format'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#collapsible' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">TRUE</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#collapsed' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">TRUE</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#weight' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$weight</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#element_validate' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'filter_form_validate'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp; );<br />
      &nbsp;&nbsp; ...<br />
      </span><span style="color: #0000BB">?&gt;</span></span>
    </code>

  </div>

  <h3 class="help"><a name="error" id="error"></a>#error</h3>
  <p>INTERNAL. Indicates whether or not a form element has been flagged as having an error.</p>

  <h3><a name="executes_submit_callback" id="executes_submit_callback"></a>#executes_submit_callback</h3>
  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#image_button">image_button</a>, <a href="#submit">submit</a></p>
<p><strong>Description</strong>: Indicates whether or not the submit handler should be run when the form is submitted using this button element.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>

  <h3 class="help"><a name="id" id="id"></a>#id</h3>
  <p>INTERNAL. Used to populate form elements' id property. In rare cases, you can set this value yourself on a form element, to override the default setting.</p>

  <h3 class="help"><a name="input" id="input"></a>#input</h3>
  <p>INTERNAL. Indicates whether or not input is possible for this form element.</p>

  <h3><a name="field_prefix" id="field_prefix"></a>#field_prefix</h3>
  <p><strong>Used by</strong>: <a href="#textfield">textfield</a></p>
  <p><strong>Description</strong>: Text or code that is placed directly in front of the textfield. This can be used to prefix a textfield with a constant string.</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/system/system.module">system.module</a>):</p>
  <div class="codeblock">
    <code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
    $form</span><span style="color: #007700">[</span><span style="color: #DD0000">'site_403'</span><span style="color: #007700">]&nbsp;=&nbsp;array(<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#type'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'textfield'</span><span style="color: #007700">,<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#title'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Default&nbsp;403&nbsp;(access&nbsp;denied)&nbsp;page'</span><span style="color: #007700">),<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#default_value'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">variable_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'site_403'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">),<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#size'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">40</span><span style="color: #007700">,<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#description'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'This&nbsp;page&nbsp;is&nbsp;displayed&nbsp;when&nbsp;the&nbsp;requested&nbsp;document&nbsp;is&nbsp;denied&nbsp;to&nbsp;the&nbsp;current&nbsp;user.&nbsp;If&nbsp;unsure,&nbsp;specify&nbsp;nothing.'</span><span style="color: #007700">),<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#field_prefix'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">url</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">TRUE</span><span style="color: #007700">)&nbsp;.&nbsp;(</span><span style="color: #0000BB">variable_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'clean_url'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;?&nbsp;</span><span style="color: #DD0000">''&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #DD0000">'?q='</span><span style="color: #007700">)<br />
    );<br /></span><span style="color: #0000BB">?&gt;</span></span></code>
  </div>

  <h3><a name="field_suffix" id="field_suffix"></a>#field_suffix</h3>
  <p><strong>Used by</strong>: <a href="#textfield">textfield</a></p>
  <p><strong>Description</strong>: Text or code that is placed directly after a textfield. This can be used to add a unit to a textfield.</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/upload/upload.module">system.module</a>):</p>
  <div class="codeblock">
    <code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
    $form</span><span style="color: #007700">[</span><span style="color: #DD0000">'settings_general'</span><span style="color: #007700">][</span><span style="color: #DD0000">'upload_usersize_default'</span><span style="color: #007700">]&nbsp;=&nbsp;array(<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#type'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'textfield'</span><span style="color: #007700">,<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#title'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Default&nbsp;total&nbsp;file&nbsp;size&nbsp;per&nbsp;user'</span><span style="color: #007700">),<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#default_value'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$upload_usersize_default</span><span style="color: #007700">,<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#size'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">,<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#maxlength'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">,<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#description'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'The&nbsp;default&nbsp;maximum&nbsp;size&nbsp;of&nbsp;all&nbsp;files&nbsp;a&nbsp;user&nbsp;can&nbsp;have&nbsp;on&nbsp;the&nbsp;site.'</span><span style="color: #007700">),<br />
    &nbsp;&nbsp;</span><span style="color: #DD0000">'#field_suffix'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'MB'</span><span style="color: #007700">)<br />
    );</span></span></code>
  </div>

  <h3><a name="maxlength" id="maxlength"></a>#maxlength</h3>
  <p><strong>Used by</strong>: <a href="#password">password</a>, <a href="#textfield">textfield</a></p>
  <p><strong>Description</strong>: The maximum amount of characters to accept as input.</p>
  <p><strong>Values</strong>: A positive number.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/forum/forum.module">forum.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'title'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textfield'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Subject'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">title</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#maxlength'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">128</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#required'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="method" id="method"></a>#method</h3>
  <p><strong>Used by</strong>: <a href="#form">form</a></p>
  <p><strong>Description</strong>: The HTTP method with which the form will be submitted.</p>
  <p><strong>Values</strong>: GET or POST. Default is POST.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/node/node.module">node.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'#method'</span><span class="g-txt">] =</span> <span class="r-txt">'post'</span><span class="g-txt">;<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="multiple" id="multiple"></a>#multiple</h3>
  <p><strong>Used by</strong>: <a href="#select">select</a></p>
  <p><strong>Description</strong>: Indicates whether the user may select more than one item.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/taxonomy/taxonomy.module">taxonomy.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br /></span> <span class="g-txt">return array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'select'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$title</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$value</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#options'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$options</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$description</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#multiple'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$multiple</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$multiple</span> <span class="g-txt">? </span><span class="b-txt">min</span><span class="g-txt">(</span><span class="b-txt">12</span><span class="g-txt">,</span> <span class="b-txt">count</span><span class="g-txt">(</span><span class="b-txt">$options</span><span class="g-txt">))<span class="r-txt"> </span></span><span class="g-txt">:</span> <span class="b-txt">0</span><span class="g-txt">,<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#weight'</span> <span class="g-txt">=&gt; -</span><span class="b-txt">15</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3 class="help"><a name="name" id="name"></a>#name</h3>
  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#submit">submit</a></p>
  <p><strong>Description</strong>: INTERNAL, except for buttons. All button and submit elements on a form should have the same name, which is set to 'op' by default in Drupal. This does not apply to image buttons. For non-button elements, Drupal sets the name by using 'foo' in $form['foo'] as well as any parents of the element.</p>
  <p><strong>Values</strong>: String.</p>
  <h3><a name="options" id="options"></a>#options</h3>
  <p><strong>Used by</strong>: <a href="#checkboxes">checkboxes</a>, <a href="#radios">radios</a>, <a href="#select">select</a></p>
  <p><strong>Description</strong>: Selectable options for a form element that allows multiple choices.</p>
  <p><strong>Values</strong>: An array in the form of <code>array(t('Display value 1'), t('Display value 2'))</code> or <code>array('return_value1' =&gt; t('Display Value 1'), 'return_value2' =&gt; t('Display Value 2'))</code> if specific return values are required.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/comment/comment.module">comment.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'posting_settings'</span><span class="g-txt">][</span><span class="r-txt">'comment_preview'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'radios'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Preview comment'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">variable_get</span><span class="g-txt">(</span><span class="r-txt">'comment_preview'</span><span class="g-txt">,</span> <span class="b-txt">1</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#options'</span> <span class="g-txt">=&gt; array(</span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Optional'</span><span class="g-txt">),</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Required'</span><span class="g-txt">)),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="parents" id="parents"></a>#parents</h3>
  <p class="help"><strong>Used by</strong>: All</p>
  <p><strong>Description</strong>: Identifies parent form elements. See <a href="http://drupal.org/node/48643">#tree and #parents</a> in the handbook.</p>
  <p class="help"><strong>Values</strong>: An array of element names.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/comment/comment.module">comment.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'admin'</span><span class="g-txt">][</span><span class="r-txt">'status'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'radios'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#parents'</span> <span class="g-txt">=&gt; array(</span><span class="r-txt">'status'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Status'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$status</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#options'</span> <span class="g-txt">=&gt; array(</span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Published'</span><span class="g-txt">),</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Not published'</span><span class="g-txt">)),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#weight'</span> <span class="g-txt">=&gt; -</span><span class="b-txt">1</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="post_render" id="post_render"></a>#post_render</h3>
  <p><strong>Used by</strong>: All elements and forms</p>
  <p><strong>Description</strong>:
Function(s) to call <strong>after</strong>
rendering in </a><a href="http://api.drupal.org/api/function/drupal_render/" class="local">drupal_render</a>()
has occured. The named function is called with two arguments, the rendered element and its children. It returns the (potentially)
altered) element content.</p>

<p><strong>Values</strong>: An array of function names to call.</p>

<p><strong>Usage example</strong>:</p>

<p><strong>Note:</strong> If you are altering an existing form via
hook_form_alter() or a similar means, be careful with this property!
You will probably want to add to the existing array rather than writing
over it, so don't follow this usage example exactly.</p>

<div class="codeblock"><code><span class="def-txt"> <span class="b-txt">&lt;?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'admin'</span><span class="g-txt">][</span><span class="r-txt">'#post_render'</span><span class="g-txt">] = array(</span><span class="r-txt">'admin_form_html_cleanup'</span><span class="g-txt">);<br />
</span><span class="b-txt">?&gt;</span></span></code>
<p>This example would call admin_form_html_cleanup($content, $element)
after $element has been rendered to $content via <a href="http://api.drupal.org/api/function/drupal_render/" class="local">drupal_render</a>().
$content may then be modified and must be returned.</p>
</div>

  <h3><a name="prefix" id="prefix"></a>#prefix</h3>
  <p><strong>Used by</strong>: All elements and forms.</p>
  <p><strong>Description</strong>: Text or markup to include before the form element. Also see <a href="#suffix">#suffix</a>.</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/poll/poll.module">poll.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'choice'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'fieldset'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Choices'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#prefix'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'&lt;div class="poll-form"&gt;'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#suffix'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'&lt;/div&gt;'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#tree'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="pre_render" id="pre_render"></a>#pre_render</h3>
  <p><strong>Used by</strong>: All elements and forms.</p>
  <p><strong>Description</strong>:
Function(s) to call <strong>before</strong>
rendering in </a><a href="http://api.drupal.org/api/function/drupal_render/" class="local">drupal_render</a>()
has occured. The function(s) provided in #pre_render receive the element as an argument and 
must return the altered element.</p>

<p><strong>Values</strong>: An array of function names to call.</p>

<p><strong>Usage example (filter.module)</strong>:</p>

<p><strong>Note:</strong> If you are altering an existing form via
hook_form_alter() or a similar means, be careful with this property!
As demonstrated here, you will probably want to add to the existing array rather than writing
over it.</p>

<div class="codeblock"><code>
// Prepend #pre_render callback to replace field value with user notice<br />
// prior to rendering.<br />
if (!isset($element['value']['#pre_render'])) {<br />
&nbsp;&nbsp;$element['value']['#pre_render'] = array();<br />
}<br />
array_unshift($element['value']['#pre_render'], 'filter_form_access_denied');<br />
<br />
...<br />
function filter_form_access_denied($element) {<br />
&nbsp;&nbsp;$element['#value'] = t('This field has been disabled because you do not have sufficient permissions to edit it.');<br />
&nbsp;&nbsp;return $element;<br />
}<br />
</code>
<p>This example would call filter_form_access_denied($element) before
the $element has been rendered via <a href="http://api.drupal.org/api/function/drupal_render/" class="local">drupal_render</a>().
$element may then be modified and is returned for rendering.</p>
</div>

  <h3 class="help"><a name="printed" id="printed"></a>#printed</h3>
  <p>INTERNAL. Used to determine whether or not a form element has been printed yet.</p>

  <h3><a name="process"></a>#process</h3>
  <p><strong>Description</strong>: An array of functions that are called when an element is processed. Using this callback, modules can "register" further actions. For example the "radios" form type is expanded to multiple radio buttons using a processing function.</p>
  <p><strong>Values</strong>: Array of function names (strings)</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/system/system.module">system.module</a>) in <code>system_elements()</code>:</p>
<p><strong>Note:</strong> If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.</p>
  <div class="codeblock">
    <code><span style="color: #0000BB">$type</span><span style="color: #007700">[</span><span style="color: #DD0000">'radios'</span><span style="color: #007700">]&nbsp;=&nbsp;array(</span><span style="color: #DD0000">'#input'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">TRUE</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'#process'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">'expand_radios'</span><span style="color: #007700">));</span></code>
    <p>In this example, the function <code>expand_radios</code> is called; the entire radios element is passed in as the argument. This function adds new elements of type <code>radio</code> to the existing <code>radios</code> element array, with keys and values corresponding to the processed element's <code>#options</code>.</p>
  </div>

  <h3 class="help"><a name="processed" id="processed"></a>#processed</h3>
  <p>INTERNAL. Used to ascertain whether or not a form element has been processed (ie: expanded to multiple elements).</p>
  <h3><a name="redirect" id="redirect"></a>#redirect</h3>
  <p><strong>Used by</strong>: <a href="#form">form</a></p>
  <p><strong>Description</strong>: The default goto value after form is submitted. This value should be returned by a form's submit callback function, but altering another form's <a href="#redirect">#redirect</a> value by using <a href="http://api.drupal.org/api/function/hook_form_alter" class="local">hook_form_alter</a>() can be useful to change where that form redirects after it is submitted. Also see <a href="#action">#action</a>.</p>
  <p><strong>Values</strong>: An internal path or an array of arguments to pass to <a href="http://api.drupal.org/api/function/drupal_goto()" class="local">drupal_goto()</a> (check that function's documentation for information on the arguments).  The value may also be set to <code>FALSE</code> to prevent redirection after form submission.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/includes/locale.inc">locale.inc</a>):</p>

  <div class="codeblock">
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />$form</span><span class="g-txt">[</span><span class="r-txt">'#redirect'</span><span class="g-txt">] = </span><span class="r-txt">'node'</span><span class="g-txt">;<br /></span><span class="b-txt">?&gt;</span></span></code></p>
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />$form</span><span class="g-txt">[</span><span class="r-txt">'#redirect'</span><span class="g-txt">] = array(</span><span class="r-txt">'user/login'</span><span class="g-txt">, </span><span class="r-txt">'destination=node&foo=bar'</span><span class="g-txt">);<br /></span><span class="b-txt">?&gt;</span></span></code></p>
    <p><code><span class="def-txt"><span class="b-txt">&lt;?php<br />$form</span><span class="g-txt">[</span><span class="r-txt">'#redirect'</span><span class="g-txt">] = </span><span class="b-txt">FALSE</span><span class="g-txt">;<br /></span><span class="b-txt">?&gt;</span></span></code></p>
  </div>

  <h3><a name="required" id="required"></a>#required</h3>
  <p><strong>Used by</strong>: <a href="#checkbox">checkbox</a>, <a href="#checkboxes">checkboxes</a>, <a href="#date">date</a>, <a href="#file">file</a>, <a href="#password">password</a>, <a href="#password_confirm">password_confirm</a>, <a href="#radio">radio</a>, <a href="#radios">radios</a>, <a href="#select">select</a>, <a href="#textarea">textarea</a>, <a href="#textfield">textfield</a>, <a href="#weight">weight</a></p>
  <p><strong>Description</strong>: Indicates whether or not the element is required. This automatically validates for empty fields, and flags inputs as required. File fields are <strong>NOT</strong> allowed to be required.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/forum/forum.module">forum.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'title'</span><span class="g-txt">] = array(<br />
    &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textfield'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Subject'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">title</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#maxlength'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">128</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#required'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="resizable" id="resizable"></a>#resizable</h3>
  <p><strong>Used by</strong>: <a href="#textarea">textarea</a></p>
  <p><strong>Description</strong>: Whether users should be allowed to resize the text area</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>

  <h3><a name="return_value" id="return_value"></a>#return_value</h3>
  <p><strong>Used by</strong>: <a href="#checkbox">checkbox</a>, <a href="#image_button">image_button</a>, <a href="#radio">radio</a></p>
  <p><strong>Description</strong>: Value element should return when selected</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/poll/poll.module">poll.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'morechoices'</span><span class="g-txt">] = array(<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'checkbox'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Need more choices'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#return_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">1</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">0</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">"If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."</span><span class="g-txt">),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="rows" id="rows"></a>#rows</h3>
  <p><strong>Used by</strong>: <a href="#textarea">textarea</a></p>
  <p><strong>Description</strong>: How many rows high the textarea should be (see also <a href="#cols">#cols</a>)</p>
  <p><strong>Values</strong>: A positive number</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/aggregator/aggregator.module">aggregator.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">] = array(<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textarea'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Description'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">],</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#cols'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#rows'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">5</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="size" id="size"></a>#size</h3>
  <p><strong>Used by</strong>: <a href="#file">file</a>, <a href="#password">password</a>, <a href="#password_confirm">password_confirm</a>, <a href="#select">select</a>, <a href="#textfield">textfield</a></p>
  <p><strong>Description</strong>: Width of the textfield (in characters) or size of multiselect box (in lines).</p>
  <p><strong>Values</strong>: A positive number.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/comment/comment.module">comment.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    &nbsp; &nbsp; &nbsp; &nbsp; $form</span><span class="g-txt">[</span><span class="r-txt">'admin'</span><span class="g-txt">][</span><span class="r-txt">'homepage'</span><span class="g-txt">] = array(<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span> <span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textfield'</span><span class="g-txt">,<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span> <span class="r-txt">'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Homepage'</span><span class="g-txt">),<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span> <span class="r-txt">'#maxlength'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">255</span><span class="g-txt">,<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span> <span class="r-txt">'#size'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">30</span><span class="g-txt">,<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span> <span class="r-txt">'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'homepage'</span><span class="g-txt">],<br />
    &nbsp; &nbsp; &nbsp; &nbsp; );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="src" id="src"></a>#src</h3>
  <p><strong>Used by</strong>: <a href="#image_button">image_button</a></p>
  <p><strong>Description</strong>: The URL of the image of the button.</p>
  <p><strong>Values</strong>: An URL.</p>

  <h3><a name="submit-prop" id="submit-prop"></a>#submit</h3>
  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#form">form</a>, <a href="#image_button">image_button</a>, <a href="#submit">submit</a></p>
  <p><strong>Description</strong>: Contains a list of submit callbacks to be excuted on the form or only when a specific button is clicked.</p>
  <p><strong>Values</strong>: An array of function names.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/menu/menu.module">menu.module</a>):</p>
<p><strong>Note:</strong> If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.</p>
  <div class="codeblock">
    <code>
      <span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
      </span><span style="color: #007700">function </span><span style="color: #0000BB">menu_form_alter</span><span style="color: #007700">(&amp;</span><span style="color: #0000BB">$form</span><span style="color: #007700">, </span><span style="color: #0000BB">$form_state</span><span style="color: #007700">, </span><span style="color: #0000BB">$form_id</span><span style="color: #007700">) {<br />
      &nbsp;&nbsp; ...&nbsp; <br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'menu'</span><span style="color: #007700">][</span><span style="color: #DD0000">'parent'</span><span style="color: #007700">] = array(<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'select'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&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">'Parent item'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#default_value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$default</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#options' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$options</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#attributes' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'class' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'menu-title-select'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp; );<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'#submit'</span><span style="color: #007700">][] = </span><span style="color: #DD0000">'menu_node_form_submit'</span><span style="color: #007700">;<br />
      }<br />
      </span><span style="color: #0000BB">?&gt;</span></span>
    </code>
  </div>

  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/menu/menu.admin.inc">menu.module</a>):</p>
  <div class="codeblock">
    <code>
      <span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
      &nbsp;&nbsp;&nbsp; $form</span><span style="color: #007700">[</span><span style="color: #DD0000">'menu_name'</span><span style="color: #007700">] = array(</span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'value'</span><span style="color: #007700">, </span><span style="color: #DD0000">'#value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$menu</span><span style="color: #007700">[</span><span style="color: #DD0000">'menu_name'</span><span style="color: #007700">]);<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'#insert'</span><span style="color: #007700">] = </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">;<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'delete'</span><span style="color: #007700">] = array(<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'submit'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Delete'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#access' </span><span style="color: #007700">=&gt; !</span><span style="color: #0000BB">in_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$menu</span><span style="color: #007700">[</span><span style="color: #DD0000">'menu_name'</span><span style="color: #007700">], </span><span style="color: #0000BB">menu_list_system_menus</span><span style="color: #007700">()),<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#submit' </span><span style="color: #007700">=&gt; array(</span><span style="color: #DD0000">'menu_custom_delete_submit'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#weight' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">10</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp; );<br />
      </span><span style="color: #0000BB">?&gt;</span></span>
    </code>
  </div>


  <h3><a name="suffix" id="suffix"></a>#suffix</h3>
  <p><strong>Used by</strong>: All elements and forms</p>
  <p><strong>Description</strong>: Text or markup to include after the form element. Also see <a href="#prefix">#prefix</a>.</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/poll/poll.module">poll.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'choice'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'fieldset'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Choices'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#prefix'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'&lt;div class="poll-form"&gt;'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#suffix'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'&lt;/div&gt;'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#tree'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="theme" id="theme"></a>#theme</h3>
  <p><strong>Used by</strong>: All elements and forms.</p>
  <p><strong>Description</strong>: Theme function to call for element.</p>
  <p><strong>Values</strong>: The name of a theme function, without the initial theme_.</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/upload/upload.module">upload.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'#theme'</span><span class="g-txt">] =</span> <span class="r-txt">'upload_form_new'</span><span class="g-txt">;<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="title" id="title"></a>#title</h3>
  <p><strong>Used by</strong>: <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="#item">item</a>, <a href="#password">password</a>, <a href="#password_confirm">password_confirm</a>, <a href="#radio">radio</a>, <a href="#radios">radios</a>, <a href="#select">select</a>, <a href="#textarea">textarea</a>, <a href="#textfield">textfield</a>, <a href="#weight">weight</a></p>
  <p><strong>Description</strong>: The title of the form element. Make sure to enclose inside the <a href="http://api.drupal.org/api/function/t">t</a>() function so this property can be translated.</p>
  <p><strong>Values</strong>: Mixed</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/aggregator/aggregator.module">aggregator.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">] = array(<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'textarea'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Description'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">],</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#cols'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#rows'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">5</span><span class="g-txt">,<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="tree" id="tree"></a>#tree</h3>
  <p><strong>Used by</strong>: All</p>
  <p><strong>Description</strong>: Used to allow collections of form elements. Normally applied to the "parent" element, as the #tree property cascades to sub-elements. Use where you previously used ][ in form_ calls. For more information, see <a href="http://drupal.org/node/48643">#tree and #parents</a> in the handbook.</p>
  <p><strong>Values</strong>: TRUE or FALSE</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/system/system.module">system.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'status'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'checkboxes'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$status</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#options'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">$options</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#tree'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
    );<br /></span> <span class="b-txt">$required</span> <span class="g-txt">= array(</span><span class="r-txt">'block'</span><span class="g-txt">,</span> <span class="r-txt">'filter'</span><span class="g-txt">,</span> <span class="r-txt">'system'</span><span class="g-txt">,</span> <span class="r-txt">'user'</span><span class="g-txt">,</span> <span class="r-txt">'watchdog'</span><span class="g-txt">);<br />
    foreach (</span><span class="b-txt">$required</span> <span class="g-txt">as</span> <span class="b-txt">$require</span><span class="g-txt">) {<br /></span> <span class="b-txt">&nbsp;&nbsp;$form</span><span class="g-txt">[</span><span class="r-txt">'status'</span><span class="g-txt">][</span><span class="b-txt">$require</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp; '#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'hidden'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp;&nbsp;'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">1</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp;&nbsp;&nbsp;&nbsp;'#suffix'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'required'</span><span class="g-txt">),<br />
    &nbsp;&nbsp;);<br />
    }<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="type" id="type"></a>#type</h3>
  <p><strong>Used by</strong>: All</p>
  <p><strong>Description</strong>: Used to determine the type of form element.</p>
  <p><strong>Values</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="#hidden">hidden</a>, <a href="#image_button">image_button</a>, <a href="#item">item</a>, <a href="#markup">markup</a>, <a href="#password">password</a>, <a href="#password_confirm">password_confirm</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="#token">token</a>, <a href="#val">value</a>, <a href="#weight">weight</a></p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/locale/locale.module">locale.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'submit'</span><span class="g-txt">] = array(</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'submit'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Import'</span><span class="g-txt">));<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="validate" id="validate"></a>#validate</h3>
  <p class="help"><strong>Used by</strong>: <a href="#button">button</a>, <a href="#image_button">image_button</a>, <a href="#form">form</a>, <a href="#submit">submit</a></p>
  <p><strong>Description</strong>: A list of custom validation functions that need to be passed.This is usually used to add additional validation functions to a form, or to use an alternate function rather than the default form validation function which is the form ID with <em>_validate</em> appended to it.</p>
  <p><strong>Values</strong>: An array of function names. Each such function will take $form and $form_state as parameters and should use form_set_error() if the form values do not pass validation. For example:</p>
  <div class="codeblock">
    <code>
    <span class="g-txt">function </span><span class="b-txt">test_form_validate</span><span class="g-txt">(</span><span class="b-txt">$form</span><span class="g-txt">, </span><span class="b-txt">&amp;$form_state</span><span class="g-txt">) {<br />
      &nbsp;&nbsp;if (</span><span class="b-txt">$form_state['values']</span><span class="g-txt">[</span><span class="r-txt">'name'</span><span class="g-txt">] == </span><span class="r-txt">''</span><span class="g-txt">) {<br />
      &nbsp;&nbsp;&nbsp;&nbsp;</span><span class="b-txt">form_set_error</span><span class="g-txt">(</span><span class="r-txt">'name'</span><span class="g-txt">, </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'You must select a name for this group of settings.'</span><span class="g-txt">));<br />
      &nbsp;&nbsp;}<br />
      }</span>
    </code>
  </div>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/node/node.module">node.module</a>):</p>
<p><strong>Note:</strong> If you are altering an existing form via hook_form_alter() or a similar means, be careful with this property! You will probably want to add to the existing array rather than writing over it, so don't follow this usage example exactly.</p>
  <div class="codeblock">
    <code>
      <span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #FF8000">// Node types:<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$types </span><span style="color: #007700">= </span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'check_plain'</span><span style="color: #007700">, </span><span style="color: #0000BB">node_get_types</span><span style="color: #007700">(</span><span style="color: #DD0000">'names'</span><span style="color: #007700">));<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'advanced'</span><span style="color: #007700">][</span><span style="color: #DD0000">'type'</span><span style="color: #007700">] = array(<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'checkboxes'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&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">'Only of the type(s)'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#prefix' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'&lt;div class="criterion"&gt;'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#suffix' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'&lt;/div&gt;'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#options' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$types</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp; );<br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'advanced'</span><span style="color: #007700">][</span><span style="color: #DD0000">'submit'</span><span style="color: #007700">] = array(<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'submit'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#value' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'Advanced search'</span><span style="color: #007700">),<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#prefix' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'&lt;div class="action"&gt;'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#suffix' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'&lt;/div&gt;'</span><span style="color: #007700">,<br />
      &nbsp;&nbsp;&nbsp; );<br />
      <br />
      &nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$form</span><span style="color: #007700">[</span><span style="color: #DD0000">'#validate'</span><span style="color: #007700">][] = </span><span style="color: #DD0000">'node_search_validate'</span><span style="color: #007700">;<br />
      </span><span style="color: #0000BB">?&gt;</span></span>
    </code>
  </div>


  <h3 class="help"><a name="validation" id="validation"></a>#validation_arguments</h3>
  <p>INTERNAL</p>

  <h3><a name="value" id="value"></a>#value</h3>
  <p><strong>Used by</strong>: <a href="#button">button</a>, <a href="#hidden">hidden</a>, <a href="#image_button">image_button</a>, <a href="#item">item</a>, <a href="#markup">markup</a>, <a href="#submit">submit</a>, <a href="#token">token</a>, <a href="#val">value</a></p>
  <p><strong>Description</strong>: Used to set values that cannot be edited by the user. <strong>Should NOT be confused with <a href="#default_value">#default_value</a></strong>, which is for form inputs where users can override the default value.</p>
  <p><strong>Values</strong>: Mixed (text or numbers)</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/locale/locale.module">locale.module</a>):</p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'submit'</span><span class="g-txt">] = array(</span><span class="r-txt">'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'submit'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Import'</span><span class="g-txt">));<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>

  <h3><a name="weightval" id="weightval"></a>#weight</h3>
  <p><strong>Used by</strong>: All elements</p>
  <p><strong>Description</strong>: Used to sort the list of form elements before being output; lower numbers appear before higher numbers.</p>
  <p><strong>Values</strong>: A positive or negative number (integer or decimal)</p>
  <p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/book/book.module">book.module</a>):<code><span class="def-txt"><span class="b-txt"><br /></span></span></code></p>
  <div class="codeblock">
    <code><span class="def-txt"><span class="b-txt">&lt;?php<br />
    $form</span><span class="g-txt">[</span><span class="r-txt">'parent'</span><span class="g-txt">] = array(<br /></span> <span class="r-txt">&nbsp;&nbsp;'#type'</span> <span class="g-txt">=&gt;</span> <span class="r-txt">'select'</span><span class="g-txt">,</span> <span class="r-txt"><br />
    &nbsp; '#title'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Parent'</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#default_value'</span> <span class="g-txt">=&gt; (</span><span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">parent</span> <span class="g-txt">?</span> <span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">parent</span> <span class="g-txt">:</span> <span class="b-txt">arg</span><span class="g-txt">(</span><span class="b-txt">4</span><span class="g-txt">)),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#options'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">book_toc</span><span class="g-txt">(</span><span class="b-txt">$node</span><span class="g-txt">-&gt;</span><span class="b-txt">nid</span><span class="g-txt">),</span> <span class="r-txt"><br />
    &nbsp;&nbsp;'#weight'</span> <span class="g-txt">=&gt; -</span><span class="b-txt">15</span><span class="g-txt">,<br />
    &nbsp;&nbsp;</span><span class="r-txt">'#description'</span> <span class="g-txt">=&gt;</span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'The parent that this page belongs in. Note that pages whose parent is &amp;lt;top-level&amp;gt; are regarded as independent, top-level books.'</span><span class="g-txt">),<br />
    );<br /></span><span class="b-txt">?&gt;</span></span></code>
  </div>
</body>
</html>

Comments

Please watch out using #disabled, as the user can use DOM manipulation and the still submit values you did not suggest. So its not readonly, as the FAPI does not secures its value is kept

To protect against this, for example if the user is editing a previously completed form, the old data should be stored in $form_state['storage'] to retrieve later in the validation or submission function if you are trying to protect overwriting old values.

Using #value instead of #default_value must solve the problem

Just re-posting what user aaron posted here - http://drupal.org/node/406802#comment-1494314

The default event for AHAH submit buttons is 'mousedown'. Due to this, even right-clicking on an AHAH button submitted it for me, causing much pain for some time.

Date is parent of three child select element, to change it you need to add #process function on date element in hook_form_alter.
This is override fapi #process function 'expand_date', from file form.inc
Example birth date on register form, changing years range from 1900-2050 to "only older than 14 can register".

<?php
$form
['Your info']['profile_birth_date']['#process'] = array('my_override_func');

function

my_override_func($element) {
 
// Default to current date
 
if (empty($element['#value'])) {
   
$element['#value'] = array('day' => format_date(time(), 'custom', 'j'),
                           
'month' => format_date(time(), 'custom', 'n'),
                           
'year' => format_date(time(), 'custom', 'Y'));
  }

 

$element['#tree'] = TRUE;

 

// Determine the order of day, month, year in the site's chosen date format.
 
$format = variable_get('date_format_short', 'm/d/Y - H:i');
 
$sort = array();
 
$sort['day'] = max(strpos($format, 'd'), strpos($format, 'j'));
 
$sort['month'] = max(strpos($format, 'm'), strpos($format, 'M'));
 
$sort['year'] = strpos($format, 'Y');
 
asort($sort);
 
$order = array_keys($sort);

 

// Output multi-selector for date.
 
foreach ($order as $type) {
    switch (
$type) {
      case
'day':
       
$options = drupal_map_assoc(range(1, 31));
        break;
      case
'month':
       
$options = drupal_map_assoc(range(1, 12), 'map_month');
        break;
      case
'year':
       
$options = drupal_map_assoc(range(1900, (date('Y') - 14)));
        break;
    }
   
$parents = $element['#parents'];
   
$parents[] = $type;
   
$element[$type] = array(
     
'#type' => 'select',
     
'#value' => $element['#value'][$type],
     
'#attributes' => $element['#attributes'],
     
'#options' => $options,
    );
  }

  return

$element;
}
?>

sorry about my english.

Having to implement a simple date (an array) or datetime field on a system_settings_form for checking by $node->created (a timestamp), I stopped pulling out my hair when I switched to date_api.

Download date, enable date_api alone, and implement '#type' => 'date_select' and you get easy, date or datetime values and a nifty UI.

Beware, sometimes default value fails -- there should be a note about this in this documentation:

<?php
$type
= array ( '#type'         =>'radios'
            
'#title'        =>t('Post type')
             , 
'#default_value'=>$internal
            
'#options'      =>array ( 0 =>t('Medical'), 1 =>t('Internal') )
             , );
?>

if your $internal is 1 "Internal" will be selected, as expected, but if it is 0, Nothing will be selected, I repeat; "Medical" will not be selected!

You can, of course, work around this by using non-zero, or named options. I believe core should be patched to test and allow '#default_value' === 0
... as this can have meaning. But pending that, you need to write extra code to swap out names for numbers or some other trick.

I couldn't find a tutorial that explained how to change the rows of a cck textarea in the node form (Drupal 6). Here's the basics:

My client wanted to change the number of rows on the node input form.

<?php
function mycustommodule_form_alter(&$form, $form_state, $form_id) {

   

    if(

$form_id == 'mycustomnodetype_node_form') {

       

$form['#field_info']['field_mycustom_cck_field']['widget']['rows'] = 5;
       
$form['body_field']['body']['#rows'] = 5;
       }

}
       

?>

Most of the time, modifications to CCK fields should be done in an #after_build callback to ensure you get the entire form and all modules have done their modifications before yours (this is of course based on weights in the DB).

<?php
function some_module_form_alter(&$form, $form_state, $form_id) {
 
$form['#after_build'][] = 'some_form_after_build';
}

function

some_form_after_build($form, &$form_state) {
 
$form['field']['#type'] = 'hidden';
  return
$form;
}
?>

Still getting errors when using #after_build rather than direct altering.

warning: htmlspecialchars() expects parameter 1 to be string, array given in /MYSITE/includes/bootstrap.inc on line 863.

If you use #after_build, don't forget to return the $form, or $form_element (first argument to your callback). You are not expected to receive it by reference like with hook_form_alter for some reason, and you will likely get a WSOD.

I copied and pasted that example because i wanted to acheive the same affect for my field prefix-- but that is outdated use of the url() function

wrong:
url(NULL, NULL, NULL, TRUE)

see here:
http://api.drupal.org/api/drupal/includes--common.inc/function/url/6

-trevor

NOTE: If using associated arrays to populate the options of a multiple select box input type, the '#default_values' needs to come before '#options' in order to have the input type repopulated correctly. See post: http://drupal.org/node/967366

don't forget the $form=array(), that was my issue...

function mytheme_form($form){
  $form=array();

The way the #image_button type functions in Drupal is slightly insane, partially because of how browsers handle image_buttons and cross-browser compatibility. Here are some guidelines for image buttons to prevent the madness, courtesy of Sid M and this issue:

1) Do give each image_button a unique #name (unlike regular buttons, you can't have several image_buttons all named op).
2) Don't give an image_button a #default_value.
3) Don't give an image_button a #value
4) Do give each image_button a #return_value. This is the same as what you would assign to #value if IE6 problems hadn't forced Drupal to implement some unusual element handling. If you don't assign this, it will default to true.
5) Do use $form_state['clicked_button']['#value'] to find the #value of, well, the clicked image_button. This field will contain the value of #return_value for the clicked image_button.

The element_validate example should read:

<?php
     
function myelement_validate($element, &$form_state) {
         if (empty(
$element['#value'])) {
          
form_error($element['#name'], t('This field is required.'));
         }
      }
?>

the example provided is fine, do not use $element['#name'] as the first argument of form_error, it throws an error (improper arguments passed to implode(). The proper way to use form_error() is how the example in the above documentation uses it:

<?php
function myelement_validate($element, &$form_state) {
   if (empty(
$element['#value'])) {
    
form_error($element, t('This field is required.'));
   }
}
?>

I display row numbers of a table from a form using the type item.
It worked in Drupal 6 but in Drupal 7.7 the '#value' doesn't seem to display.
I've moved the code elsewhere, changed it to a fixed value, but I can't get it to show.
What am I doing wrong?

<?php
$form
['dimensionset']['row'] = array(
       
'#type' => 'item',
       
'#title' => t('Row'),
       
'#value' => ($form_state['storage']['step'] - 3),
       
'#prefix' => '<div><div style="float:left;">',
       
'#suffix' => '</div>',
    );
?>

You've probably long-since discovered this or given up, but item and markup fields use #markup, not #value in D7.

Drupal 6: Be aware that currently the #id attribute get removed from the types radios and checkboxes. If you want them in the form-item wrapper DIV you need to put theme_radios() and theme_checkboxes() into your template.php. Remove the line unset($element['#id']); in both function. See http://drupal.org/node/453400 for a discussion about this.

Not mentioned in this page: #maxlength can be used with textarea.

To ensure a better compatibility with the built in error messages for required fields, the example code under "#element_validate" should look more like this:

<?php
function myelement_validate($element, &$form_state) {
   if (empty(
$element['#value'])) {
    
form_error($elementt('!name field is required.', array('!name' => $element['#title'])));
   }
}
?>

Note that you need to register the theme function in hook_theme before you can use it as a #theme form element. #doh

function my_module_theme($existing, $type, $theme, $path) {
  return array(
    'my_module_my_custom_form' => array(
    'arguments' => array('form' => null),
  ),
}

Is there any plan to allow HTML5 form elements such as email, tel, search, url, email, etc.? I realize that they not all supported by all browsers yet, but they will be anon.

If you are altering an existing form using hook_form_alter(), make sure that you don't replace #attributes array completely.
e.x:

<?php
$form
['my_field']['#attributes']['rel'] = 'lightbox'; // do this.
$form['my_field']['#attributes'] = array('rel' => 'lightbox'); // do NOT do this.
?>

Not documented above, set form element attribute '#wysiwyg' => FALSE to disable any rich text editor like FckEditor, TinyMCE, forcing plain text textarea.

For example:

<?php
    $form
['body'] = array(
     
'#type' => 'textarea',
     
'#title' => $title,
     
'#wysiwyg' => FALSE,
    );
?>

Thanks to @jeff00seattle's comment on May 12, 2009 at 9:21pm merely transcribed here.

If you want to have a read-only value in a form but preserve the pre-set value on form submission, setting #default to true is not for you. The value for this field will be empty when the form is submitted.

Oops, forgot the workaround:

'#attributes' => array('readonly' => 'readonly')

This will preserve the field value on submission.