forms_api_reference.html
<!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">
<!-- $Id: forms_api_reference.html,v 1.85 2008/07/17 16:29:15 pwolanin Exp $ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Forms 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;
}
.def-txt {color: #000000}
.r-txt {color: #DD0000}
.g-txt {color: #007700}
.b-txt {color: #0000BB}
.y-txt {color: #FF8000}
/*]]>*/
</style>
</head>
<body>
<h1>Forms 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://api.drupal.org/api/file/developer/topics/forms_api.html">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="#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> <!-- 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 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="#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> <!-- 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="#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 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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>-</td> <!-- password -->
<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> <!-- 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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="#return_value">#return_value</a></th>
<td class="x"><strong>X</strong></td> <!-- checkbox -->
<td class="x"><strong>X</strong></td> <!-- checkboxes -->
<td>-</td> <!-- date -->
<td>-</td> <!-- fieldset -->
<td>-</td> <!-- file -->
<td>-</td> <!-- password -->
<td class="x"><strong>X</strong></td> <!-- radio -->
<td class="x"><strong>X</strong></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> <!-- 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>-</td> <!-- file -->
<td>-</td> <!-- password -->
<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> <!-- 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> <!-- 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> <!-- 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> <!-- 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> <!-- 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="#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="#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><!-- 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>-</td><!-- hidden -->
<td>-</td><!-- markup -->
<td>-</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><!-- 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 class="x"><strong>X</strong></td><!-- hidden -->
<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="#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><!-- 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>-</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><!-- markup -->
<td class="x"><strong>X</strong></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><!-- markup -->
<td class="x"><strong>X</strong></td><!-- item -->
<td class="x"><strong>X</strong></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><!-- markup -->
<td>-</td><!-- item -->
<td>-</td><!-- value -->
</tr>
<tr>
<th scope="row"><a href="#markup-attribute">#markup</a></th>
<td>-</td><!-- button -->
<td>-</td><!-- image_button -->
<td>-</td><!-- submit -->
<td>-</td><!-- form -->
<td>-</td><!-- hidden -->
<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="#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><!-- 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>-</td><!-- markup -->
<td>-</td><!-- item -->
<td class="x"><strong>X</strong></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><!-- 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><!-- 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><!-- markup -->
<td class="x"><strong>X</strong></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><!-- markup -->
<td>-</td><!-- item -->
<td>-</td><!-- value -->
</tr>
<tr>
<th scope="row"><a href="#required">#required</a></th>
<td>-</td><!-- button -->
<td>-</td><!-- image_button -->
<td>-</td><!-- submit -->
<td>-</td><!-- form -->
<td class="x"><strong>X</strong></td><!-- hidden -->
<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><!-- markup -->
<td>-</td><!-- item -->
<td>-</td><!-- value -->
</tr>
<tr>
<th scope="row"><a href="##submit">#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><!-- 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><!-- 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><!-- 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><!-- 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>-</td><!-- markup -->
<td>-</td><!-- item -->
<td class="x"><strong>X</strong></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><!-- 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>-</td><!-- hidden -->
<td>-</td><!-- markup -->
<td>-</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>-</td><!-- hidden -->
<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> = 'click' </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> = 1</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> = 'click' </li>
</ul>
</li>
<li>
<a href="#item"><strong>item</strong></a>
<ul>
<li><a href="#prefix">#prefix</a> = ''</li>
<li><a href="#suffix">#suffix</a> = ''</li>
</ul>
</li>
<li>
<a href="#markup"><strong>markup</strong></a>
<ul>
<li><a href="#prefix">#prefix</a> = ''</li>
<li><a href="#suffix">#suffix</a> = ''</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> = 30</li>
<li><a href="#maxlength">#maxlength</a> = 64</li>
<li><a href="#ahah_event">#ahah['event']</a> = 'blur' </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> = 'click' </li>
</ul>
</li>
<li>
<strong><a href="#textarea">textarea</a></strong>
<ul>
<li><a href="#cols">#cols</a> = 60</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> </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="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#button_type">#button_type</a> (default: submit), <a href="#executes_submit_callback">#executes_submit_callback</a> (default: FALSE), <a href="#name">#name</a> (default: op), <a href="#post_render">#post_render</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#pre_render">#pre_render</a>, <a href="#suffix">#suffix</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/file/modules/node/node.module">node.module</a>):</p>
<div class="codeblock">
<p><code><span class="def-txt"><span class="b-txt"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'preview'</span><span class="g-txt">] = array(<br />
</span> <span class="r-txt">'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'button'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#value'</span> <span class="g-txt">=></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 />
'#weight'</span> <span class="g-txt">=></span> <span class="b-txt">19,<br /></span><span class="g-txt">);<br /></span> <span class="b-txt">?></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="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</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="#return_value"><strong>#return_value</strong></a> (default: 1), <a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'copy'</span><span class="g-txt">] = array(<br />
</span> <span class="r-txt">'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'checkbox'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=> t(</span><span class="r-txt">'Send me a copy.'</span><span class="g-txt">),<br />
);<br /></span><span class="b-txt">?></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="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#options"><strong>#options</strong></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"></a><a href="#suffix">#suffix</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"><?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">-></span><span class="b-txt">type</span><span class="g-txt">] = array(<br /></span></span></code> <code> <span class="def-txt"><span class="r-txt">'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'checkboxes'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#default_value'</span> <span class="g-txt">=></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">-></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> <span class="r-txt">'#options'</span> <span class="g-txt">=> array(</span><span class="r-txt"><br />
'status'</span> <span class="g-txt">=></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 />
'moderate'</span> <span class="g-txt">=></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 />
'promote'</span> <span class="g-txt">=></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 />
</span><span class="r-txt">'sticky'</span> <span class="g-txt">=></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 />
</span><span class="r-txt">'revision'</span> <span class="g-txt">=></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 />
),</span><span class="g-txt"><br /></span> <span class="r-txt">'#description'</span> <span class="g-txt">=></span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Users with the <em>administer nodes</em> permission will be able to override these options.'</span><span class="g-txt">),<br />
);<br /></span> <span class="b-txt">?></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">=></span> <span class="b-txt">2007</span><span class="g-txt">,</span> <span class="r-txt">'month'</span> <span class="g-txt">=></span> <span class="b-txt">2</span><span class="g-txt">,</span> <span class="r-txt">'day'</span> <span class="g-txt">=></span> <span class="b-txt">15</span><span class="g-txt">)</span></code></p>
<p><strong>Properties</strong>: <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</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"></a><a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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">-></span><span class="b-txt">name</span><span class="g-txt">] = array(<br />
</span><span class="r-txt">'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'date'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></span> <span class="b-txt">check_plain</span><span class="g-txt">(</span><span class="b-txt">$field</span><span class="g-txt">-></span><span class="b-txt">title</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="b-txt">$field</span><span class="g-txt">-></span><span class="b-txt">name</span><span class="g-txt">],</span> <span class="r-txt"><br />
'#description'</span> <span class="g-txt">=></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 />
'#required'</span> <span class="g-txt">=></span> <span class="b-txt">$field</span><span class="g-txt">-></span><span class="b-txt">required<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?></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="#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="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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 />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'fieldset'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#weight'</span> <span class="g-txt">=></span> <span class="b-txt">5</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#collapsible'</span> <span class="g-txt">=></span> <span class="b-txt">TRUE</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#collapsed'</span> <span class="g-txt">=></span> <span class="b-txt">FALSE</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></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' => "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="#attributes">#attributes</a>, <a href="#description">#description</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#size"><strong>#size</strong></a> (default: 60), <a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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 />
</span> <span class="r-txt">'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'file'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#size'</span> <span class="g-txt">=></span> <span class="b-txt">40,<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?></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="#action">#action</a> (default: request_uri()), <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="##submit">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</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="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#suffix">#suffix</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"><?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">=></span> <span class="r-txt">'hidden'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=></span> <span class="b-txt">$bid</span><span class="g-txt">);<br /></span><span class="b-txt">?></span></span></code>
</div>
<h3><a name="image_button" id="image_button"></a>image_button</h3>
<p><strong>Description</strong>: Format a form submit button with an image.</p>
<p><strong>Properties</strong>: <a href="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#button_type">#button_type</a> (default: 'submit'), <a href="#executes_submit_callback">#executes_submit_callback</a> (default: TRUE), <a href="#name">#name</a> (default: 'op'), <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#src">#src</a>, <a href="#suffix">#suffix</a>, <a href="##submit">#submit</a>, <a href="#type"><strong>#type</strong></a>. <a href="#value"><strong>#value</strong></a>, <a href="#weightval">#weight</a></p>
<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 <p> or <div>), your content will fall outside of collapsed fieldsets.</p>
<p><strong>Properties</strong>: <a href="#attributes">#attributes</a>, <a href="#description"></a> <a href="#prefix">#prefix</a> (default: ''), <a href="#suffix">#suffix</a> (default: ''), <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"><?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 />
'#value'</span> <span class="g-txt">=></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">?></span></span></code>
</div>
<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="#attributes">#attributes</a>, <a href="#description">#description</a>, <a href="#prefix">#prefix</a> (default: ''), <a href="#required">#required</a>, <a href="#suffix">#suffix</a> (default: ''), <a href="#title"><strong>#title</strong></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"><?php<br /></span></span></code> <span class="b-txt"><code>$form[<span class="r-txt">'from'</span>] = <span class="g-txt">array(</span><br />
</code><code><span class="r-txt">'#type'</span> => <span class="r-txt">'item'</span>,<br />
<span class="r-txt">'#title'</span> => t(<span class="r-txt">'From'</span>),<br />
<span class="r-txt">'#value'</span> => $user->name .<span class="r-txt">' &lt;'</span>. $user->mail .<span class="r-txt">'&gt;'</span>,<br />
<span class="g-txt">);</span></code></span><code><span class="def-txt"><span class="g-txt"><br /></span> <span class="b-txt">?></span></span></code></p>
</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="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#description">#description</a>, <a href="#maxlength"><strong>#maxlength</strong></a> (default: 30), <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="#size"><strong>#size</strong></a> (default: 64), <a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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 />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'password'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#maxlength'</span> <span class="g-txt">=></span> <span class="b-txt">64</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#size'</span> <span class="g-txt">=></span> <span class="b-txt">15</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></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="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</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="#title"><strong>#title</strong></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="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#options"><strong>#options</strong></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"></a><a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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 />
</span><span class="r-txt">'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'radios'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#default_value'</span> <span class="g-txt">=></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 />
'#options'</span> <span class="g-txt">=> 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">?></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="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#multiple"><strong>#multiple</strong></a>, <a href="#options"><strong>#options</strong></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"></a><a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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"> '#type'</span> <span class="g-txt">=></span> <span class="r-txt">'select'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#default_value'</span> <span class="g-txt">=></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"> '#options'</span> <span class="g-txt">=> array(</span><span class="r-txt"><br />
'title'</span> <span class="g-txt">=></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 />
'teaser'</span> <span class="g-txt">=></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 />
'fulltext'</span> <span class="g-txt">=></span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Full text'</span><span class="g-txt">),<br />
),<br /></span> <span class="r-txt"> '#description'</span> <span class="g-txt">=></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">?></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="#ahah">#ahah</a>, <a href="#attributes">#attributes</a>, <a href="#button_type">#button_type</a> (default: 'submit'), <a href="#executes_submit_callback">#executes_submit_callback</a> (default: TRUE), <a href="#name">#name</a> (default: 'op'), <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="#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/file/modules/locale/locale.module">locale.module</a>):</p>
<div class="codeblock">
<code><span class="def-txt"><span class="b-txt"><?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">=></span> <span class="r-txt">'submit'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=></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">?></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="#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="#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"></a><a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></a>, <a href="#type"><strong>#type</strong></a>. <a href="#rows"><strong>#rows</strong></a> (default: 5), <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"><?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 />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'textarea'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$node</span><span class="g-txt">-></span><span class="b-txt">body</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#required'</span> <span class="g-txt">=></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">?></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="#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="#field_prefix">#field_prefix</a>, <a href="#field_suffix">#field_suffix</a>, <a href="#maxlength"><strong>#maxlength</strong></a> (default: 128), <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="#size"><strong>#size</strong></a> (default: 60), <a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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 />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'textfield'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$node</span><span class="g-txt">-></span><span class="b-txt">title</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#size'</span> <span class="g-txt">=></span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#maxlength'</span> <span class="g-txt">=></span> <span class="b-txt">128</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#required'</span> <span class="g-txt">=></span> <span class="b-txt">TRUE</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></span></span></code>
</div>
<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"><?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> => <span class="r-txt">'value'</span><span class="g-txt">,</span> <span class="r-txt">'#value'</span> <span class="g-txt">=></span> <span class="b-txt">$node->vid</span><span class="g-txt">);<br /></span><span class="b-txt">?></span></span></code></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="#attributes">#attributes</a>, <a href="#delta"><strong>#delta</strong></a> (default: 10), <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</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"></a><a href="#suffix">#suffix</a>, <a href="#title"><strong>#title</strong></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"><?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 />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'weight'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#title'</span> <span class="g-txt">=></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 />
'#default_value'</span> <span class="g-txt">=></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 />
'#delta'</span> <span class="g-txt">=></span> <span class="b-txt">10</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#description'</span> <span class="g-txt">=></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">?></span></span></code>
</div>
<h2><a name="properties" id="properties"></a>Properties</h2>
<h3><a name="access" id="access"></a>#access</h3>
<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 of 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"><?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">?></span></span></code></p>
<p>Do not forget the # before property names.</p>
</div>
<h3><a name="after_build" id="after_build"></a>#after_build</h3>
<p>An array of function names which will be called after the form is built. Example: node preview.</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">
<p><code><span class="def-txt"><span class="b-txt"><?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"> '#type'</span> <span class="g-txt">=></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"> </span></span></code>'#title'</span> <span class=