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"><head><!-- $Id: forms_api_reference.html,v 1.116 2009/11/26 02:49:50 rfay Exp $ -->
<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;
}
.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 Form 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/7">Form 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">
<tbody><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="#tableselect">tableselect</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="#vertical_tabs">vertical_tabs</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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<td class="x"><strong>X</strong></td> <!-- weight -->
</tr>
<tr>
<th scope="row"><a href="#ajax">#ajax</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 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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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>-</td> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<td>-</td> <!-- weight -->
</tr>
<tr>
<th scope="row"><a href="#default_tab">#default_tab</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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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>-</td> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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>-</td> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<td class="x"><strong>X</strong></td> <!-- weight -->
</tr>
<tr>
<th scope="row"><a href="#empty">#empty</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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<td>-</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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<td>-</td> <!-- weight -->
</tr>
<tr>
<th scope="row"><a href="#header">#header</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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<td>-</td> <!-- weight -->
</tr>
<tr>
<th scope="row"><a href="#js_select">#js_select</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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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 class="x"><strong>X</strong></td> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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 class="x"><strong>X</strong></td> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<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> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<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> <!-- vertical_tabs -->
<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>-</td> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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>-</td> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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>-</td> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td>-</td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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 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> <!-- tableselect -->
<td>-</td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<td class="x"><strong>X</strong></td> <!-- weight -->
</tr>
<tr>
<th scope="row"><a href="#text_format">#text_format</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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<td>-</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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<td class="x"><strong>X</strong></td> <!-- weight -->
</tr>
<tr>
<th scope="row"><a href="#theme_wrappers">#theme_wrappers</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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<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>-</td> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td>-</td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<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> <!-- tableselect -->
<td class="x"><strong>X</strong></td> <!-- textarea -->
<td class="x"><strong>X</strong></td> <!-- textfield -->
<td class="x"><strong>X</strong></td> <!-- vertical_tabs -->
<td class="x"><strong>X</strong></td> <!-- weight -->
</tr>
</tbody></table>
<h2>Special Elements</h2>
<table border="1">
<tbody><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="#ajax">#ajax</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="#markup-attribute">#markup</a></th>
<td>-</td><!-- button -->
<td>-</td><!-- image_button -->
<td>-</td><!-- submit -->
<td>-</td><!-- form -->
<td>-</td><!-- hidden -->
<td>-</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="#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 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><!-- 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_property">#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="#theme_wrappers">#theme_wrappers</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>-</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 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>
</tbody></table>
<h2><a name="element_default_values" id="element_default_values"></a>Default Values</h2>
<p>Every element automatically has these default values (see system_elements()):</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="#ajax_event">#ajax['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="#ajax_event">#ajax['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-type: none; list-style-image: none; list-style-position: outside;">
<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="#ajax_event">#ajax['event']</a> = 'click' </li>
</ul>
</li>
<li><strong><a href="#radio">radio</a></strong></li>
<li style="list-style-type: none; list-style-image: none; list-style-position: outside;">
<ul>
<li><a href="#ajax_event">#ajax['event']</a> = 'change' </li>
</ul>
</li>
<li><strong><a href="#password">password</a></strong></li>
<li style="list-style-type: none; list-style-image: none; list-style-position: outside;">
<ul>
<li><a href="#size">#size</a> = 60</li>
<li><a href="#maxlength">#maxlength</a> = 128</li>
<li><a href="#ajax_event">#ajax['event']</a> = 'blur' </li>
</ul>
</li>
<li><strong><a href="#password_confirm">password_confirm</a></strong></li>
<li style="list-style-type: none; list-style-image: none; list-style-position: outside;">
<ul>
<li><a href="#size">#size</a> = 60</li>
</ul>
</li>
<li><strong><a href="#submit">submit</a></strong></li>
<li style="list-style-type: none; list-style-image: none; list-style-position: outside;">
<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="#ajax_event">#ajax['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="#resizable">#resizable</a> = TRUE</li>
<li><a href="#rows">#rows</a> = 5</li>
<li><a href="#ajax_event">#ajax['event']</a> = 'blur' </li>
</ul>
</li>
<li><strong><a href="#textfield">textfield</a></strong></li>
<li style="list-style-type: none; list-style-image: none; list-style-position: outside;">
<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="#ajax_event">#ajax['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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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_property">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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"><?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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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="#theme_wrappers">#theme_wrappers</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"><?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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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"></a><a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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="#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"></a><a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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"><?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="#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="#theme_wrappers">#theme_wrappers</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"><?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="#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="#theme_wrappers">#theme_wrappers</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"><?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="#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="#process">#process</a>, <a href="#redirect">#redirect</a>, <a href="#submit_property">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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="#ajax">#ajax</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="#theme_wrappers">#theme_wrappers</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/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>
<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.</p>
<p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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_property">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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="#markup-attribute">#markup</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="#theme_wrappers">#theme_wrappers</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/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">'#markup'</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="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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#element_validate">#element_validate</a>, <a href="#markup-attribute">#markup</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="#theme_wrappers">#theme_wrappers</a>, <a href="#tree">#tree</a>, <a href="#type">#type</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 />
'#markup'</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="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="#ajax">#ajax</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="#theme_wrappers">#theme_wrappers</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"><?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="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="#theme_wrappers">#theme_wrappers</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"><?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_confirm'</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 />
'#size'</span> <span class="g-txt">=></span> <span class="b-txt">25</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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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="#theme_wrappers">#theme_wrappers</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="#ajax">#ajax</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="#theme_wrappers">#theme_wrappers</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"><?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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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="#theme_wrappers">#theme_wrappers</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"><?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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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_property">#submit</a>, <a href="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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"><?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="tableselect" id="tableselect"></a>tableselect</h3>
<p><strong>Description</strong>:
Format a table of radios or checkboxes, where the columns are given by
the #headers property, and the rows are the #options property. The
choice of radios or checkboxes depends on the #multiple property, and
JavaScript-enabled "check all" buttons are added if the #js_select
property is TRUE.</p>
<p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</a>, <a href="#attributes">#attributes</a>, <a href="#default_value"><strong>#default_value</strong></a>, <a href="#element_validate">#element_validate</a>, <a href="#empty">#empty</a>, <a href="#header">#header</a>, <a href="#js_select">#js_select</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="#suffix">#suffix</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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/comment/comment.admin.inc">comment.admin.inc</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">'comments'</span><span class="g-txt">] = array(</span><span class="r-txt"><br />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'tableselect'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#header'</span> <span class="g-txt">=></span> <span class="r-txt">$header</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#options'</span> <span class="g-txt">=></span> <span class="r-txt">$options</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#empty'</span> <span class="g-txt">=></span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'No comments available'</span><span class="g-txt">),</span> <span class="r-txt"><br />);<br /></span> <span class="b-txt">?></span></span></code></p>
</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="#ajax">#ajax</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="#text_format">#text_format</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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/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">'comment'</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">'Comment'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$default</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#text_format'</span> <span class="g-txt">=></span> <span class="g-txt">isset(</span><span class="b-txt">$edit</span><span class="g-txt">-></span><span class="b-txt">format</span><span class="g-txt">) ? </span><span class="b-txt">$edit</span><span class="g-txt">-></span><span class="b-txt">format</span><span class="g-txt"> : </span><span class="b-txt">FILTER_FORMAT_DEFAULT</span><span class="g-txt">)</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="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</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="#text_format">#text_format</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</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"><?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="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="#theme_wrappers">#theme_wrappers</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"><?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>
<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="vertical_tabs" id="vertical_tabs"></a>vertical_tabs</h3>
<p><strong>Description</strong>: Format all child fieldsets as vertical tabs.</p>
<p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#default_tab">#default_tab</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="#theme_wrappers">#theme_wrappers</a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></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="#theme_wrappers">#theme_wrappers</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"><?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>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"><?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>
</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"><?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="g-txt">=></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"> </span></span></code>'#default_value'</span> <span class="g-txt">=></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"> </span></span></code>'#maxlength'</span> <span class="g-txt">=></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"> </span></span></code>'#description'</span> <span class="g-txt">=></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">&$form_state</span><span class="g-txt">) {<br /></span> <span class="b-txt"> 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"> </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">?></span></span></code></p>
</div>
<h3><a name="ajax" id="ajax"></a>#ajax</h3>
<p><strong>Used by</strong>:
<a href="#button">button</a>,
<a href="#checkbox">checkbox</a>,
<a href="#checkboxes">checkboxes</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="#radios">radios</a>,
<a href="#select">select</a>,
<a href="#submit">submit</a>,
<a href="#tableselect">tableselect</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 AJAX javascript methods.</p>
<p><a href="http://en.wikipedia.org/wiki/AJAX">AJAX</a>
(Asynchronous Javascript and XML) is a term used for dynamic
communication between the browser and the server, without page reloads.
A purist would insist that the Drupal technique is <a href="http://en.wikipedia.org/wiki/AHAH">AHAH</a>
(Asychronous HTML and HTTP) because XML is not used. Until Drupal 7,
AJAX was known as AHAH. In a nutshell an AJAX request follows these
steps:</p>
<ol>
<li>Drupal builds a form element with a set of #ajax properties. The <code>misc/ajax.js</code> file is included on the page automatically. </li>
<li>ajax.js finds all the form elements on the page that have an <a href="#ajax_callback">#ajax['callback']</a> <em>or</em> an <a href="#ajax_path">#ajax['path']</a> set and adds an event handler for the <a href="#ajax_event">#ajax['event']</a> set on that form element.</li>
<li>When the <a href="#ajax_event">#ajax['event']</a> occurs on the element (such as 'click'), the AJAX request is made to the Drupal path of the element's <a href="#ajax_path">#ajax['path']</a>. If an <a href="#ajax_callback">#ajax['callback']</a> has been specified (the normal case), the Drupal path will be <code>system/ajax</code>.</li><li>Form information gets processed, and the function specified in <a href="#ajax_callback">#ajax['callback']</a> is called. <a href="forms_api_reference.html#ajax_callback">#ajax['callback']</a> can return either HTML, a renderable array, or an array of <a href="http://api.drupal.org/api/group/ajax_commands/7">AJAX commands</a>.</li>
<li>While the user
waits for the callback to execute a throbber or progress bar is shown
as determined by <a href="#ajax_progress">#ajax['progress']</a>. The result is returned to the original page containing the form element.</li>
<li>ajax.js gets the result. If it is HTML and <a href="forms_api_reference.html#ajax_wrapper">#ajax['wrapper']</a> is set, the HTML replaces the element specified by <a href="forms_api_reference.html#ajax_wrapper">#ajax['wrapper']</a>. If it is an array of AJAX commands, the commands are executed. and inserts the returned HTML into the <a href="#ajax_wrapper">#ajax['wrapper']</a>. </li>
</ol>Example usages of basic AJAX and AJAX commands are provided in the <a href="http://drupal.org/project/examples">Examples module</a>.
<h3><a name="ajax_callback" id="ajax_callback"></a>#ajax['callback']</h3>
<p><strong>Description</strong>:
Specifies the name of a callback function which will be called during
an AJAX call. It can return HTML, a renderable array, or an array of <a href="http://api.drupal.org/api/group/ajax_commands/7">AJAX Commands</a>. This callback
function is given the <code>$form</code> and <code>$form_state</code> parameters, allowing it to produce a result, which it returns for rendering.</p><p>Note:
#ajax['callback'] and #ajax['path'] are mutually exclusive. 'callback' is easier to
use and requires less code setup, but may not provide the
capabilities required for some functions.</p>
<p><strong>Values</strong>: String containing a function name.</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: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 187);"><?php<br /></span><span style="color: rgb(255, 128, 0);">/**<br /> * Implementation of hook_form().<br /> */<br /></span><span style="color: rgb(0, 119, 0);">function </span><span style="color: rgb(0, 0, 187);">poll_form</span><span style="color: rgb(0, 119, 0);">(&</span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$form_state</span><span style="color: rgb(0, 119, 0);">) {<br /> ...<br /> </span><span style="color: rgb(0, 0, 187);">$form</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'choice_wrapper'</span><span style="color: rgb(0, 119, 0);">][</span><span style="color: rgb(221, 0, 0);">'poll_more'</span><span style="color: rgb(0, 119, 0);">] = array(<br /> </span><span style="color: rgb(221, 0, 0);">'#type' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'submit'</span><span style="color: rgb(0, 119, 0);">,<br /> </span><span style="color: rgb(221, 0, 0);">'#value' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'More choices'</span><span style="color: rgb(0, 119, 0);">),<br /> </span><span style="color: rgb(221, 0, 0);">'#description' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">"If the amount of boxes above isn't enough, click here to add more choices."</span><span style="color: rgb(0, 119, 0);">),<br /> </span><span style="color: rgb(221, 0, 0);">'#weight' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(0, 0, 187);">1</span><span style="color: rgb(0, 119, 0);">,<br /> </span><span style="color: rgb(221, 0, 0);">'#submit' </span><span style="color: rgb(0, 119, 0);">=> array(</span><span style="color: rgb(221, 0, 0);">'poll_more_choices_submit'</span><span style="color: rgb(0, 119, 0);">), </span><span style="color: rgb(255, 128, 0);">// If no javascript action.<br /> </span><span style="color: rgb(221, 0, 0);">'#ajax' </span><span style="color: rgb(0, 119, 0);">=> array(<br /> </span><span style="color: rgb(221, 0, 0);">'callback' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'poll_choice_js'</span><span style="color: rgb(0, 119, 0);">,<br /> </span><span style="color: rgb(221, 0, 0);">'wrapper' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'poll-choices'</span><span style="color: rgb(0, 119, 0);">,<br /> </span><span style="color: rgb(221, 0, 0);">'method' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'replace'</span><span style="color: rgb(0, 119, 0);">,<br /> </span><span style="color: rgb(221, 0, 0);">'effect' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'fade'</span><span style="color: rgb(0, 119, 0);">,<br /> ),<br /> );<br /> ...<br />}<br /><br /></span><span style="color: rgb(255, 128, 0);">/**<br /> * Menu callback for AJAX additions. Render the new poll choices.<br /> */<br /></span><span style="color: rgb(0, 119, 0);">function poll_choice_js($form, $form_state) {<br /> return $form['choice_wrapper']['choice'];<br />}<br /></span><span style="color: rgb(0, 119, 0);">?></span>
</span>
</code>
</div>
<h3><a name="ajax_effect" id="ajax_effect"></a>#ajax['effect']</h3>
<p><strong>Description</strong>: Specifies the effect used when adding the content from an AJAX 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>
<h3><a name="ajax_event" id="ajax_event"></a>#ajax['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: 'click', 'blur', 'change'.
Note that #ajax['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="ajax_method" id="ajax_method"></a>#ajax['method']</h3>
<p><strong>Description</strong>: Modify the behavior of the returned HTML from an AJAX request when inserting into the <a href="#ajax_wrapper">#ajax['wrapper']</a>. If not set, the returned HTML will <span style="font-style: italic;">replace</span> 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="ajax_path" id="ajax_path"></a>#ajax['path']</h3>
<p><strong>Description</strong>:
This is the Drupal menu path for a callback function which will generate
HTML and return the string of HTML to Drupal. The result will replace the div specified in <a href="#ajax_wrapper">#ajax['wrapper']</a>. This property is infrequently used in Drupal 7 and higher, because it is set automatically if using the <a href="#ajax_callback">#ajax['callback']</a> property. When using #ajax['callback'] the path is automatically set to <code>system/ajax</code>, which provides a menu callback that can be used for many situations.</p><p>Note: 'path' and 'callback' are mutually exclusive.</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 class="def-txt"><span class="b-txt"><?php<br /></span><span class="y-txt">/**<br />* Implementation of hook_menu().<br />*/<br /></span><span class="g-txt">function </span><span class="b-txt">upload_menu</span><span class="g-txt">() {<br /> </span><span class="b-txt">$items</span><span class="g-txt">[</span><span class="r-txt">'upload/js'</span><span class="g-txt">] = array(<br /> </span><span class="r-txt">'page callback' </span><span class="g-txt">=> </span><span class="r-txt">'upload_js'</span><span class="g-txt">,<br /> </span><span class="r-txt">'access arguments' </span><span class="g-txt">=> array(</span><span class="r-txt">'upload files'</span><span class="g-txt">),<br /> </span><span class="r-txt">'type' </span><span class="g-txt">=> </span><span class="b-txt">MENU_CALLBACK</span><span class="g-txt">,<br /> );<br /> ...<br /> return </span><span class="b-txt">$items</span><span class="g-txt">;<br />}<br /><br />...<br /><br />function </span><span class="b-txt">_upload_form</span><span class="g-txt">(</span><span class="b-txt">$node</span><span class="g-txt">) {<br /> ...<br /> </span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'new'</span><span class="g-txt">][</span><span class="r-txt">'attach'</span><span class="g-txt">] = array(<br /> </span><span class="r-txt">'#type' </span><span class="g-txt">=> </span><span class="r-txt">'submit'</span><span class="g-txt">,<br /> </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">'Attach'</span><span class="g-txt">),<br /> </span><span class="r-txt">'#name' </span><span class="g-txt">=> </span><span class="r-txt">'attach'</span><span class="g-txt">,<br /> </span><span class="r-txt">'#ajax' </span><span class="g-txt">=> array(<br /> </span><span class="r-txt">'path' </span><span class="g-txt">=> </span><span class="r-txt">'upload/js'</span><span class="g-txt">,<br /> </span><span class="r-txt">'wrapper' </span><span class="g-txt">=> </span><span class="r-txt">'attach-wrapper'</span><span class="g-txt">,<br /> </span><span class="r-txt">'progress' </span><span class="g-txt">=> array(</span><span class="r-txt">'type' </span><span class="g-txt">=> </span><span class="r-txt">'bar'</span><span class="g-txt">, </span><span class="r-txt">'message' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Please wait...'</span><span class="g-txt">)),<br /> ),<br /> </span><span class="r-txt">'#submit' </span><span class="g-txt">=> array(</span><span class="r-txt">'node_form_submit_build_node'</span><span class="g-txt">),<br /> );<br /> ...<br />return </span><span class="b-txt">$form</span><span class="g-txt">;<br /></span><span class="b-txt">?></span></span></code></div>
<p>#ajax['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="ajax_progress" id="ajax_progress"></a>#ajax['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>#ajax['progress']['type']</strong> String. Possible values: 'throbber' (default), 'bar'.
</li>
<li><strong>#ajax['progress']['message']</strong> String. An optional message to the user; should be wrapped with t().
</li>
<li><strong>#ajax['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 'progress'. </li>
<li><strong>#ajax['progress']['interval']</strong>
String. The iterval to be used in updating the progress bar (as defined
in progress.js). Ony used if 'url' is defined and 'type' is 'progress'.
</li>
</ul>
<p><strong>Usage example</strong>: see <a href="#ajax_path">above usage</a> in upload.module</p>
<h3><a name="ajax_wrapper" id="ajax_wrapper"></a>#ajax['wrapper']</h3>
<p><strong>Description</strong>:
This property defines the HTML id attribute of an element on the page
which will be replaced by the html returned by the <a href="#ajax_path">#ajax['path']</a> or <a href="#ajax_callback">#ajax['callback']</a>
function. Usually, a div element is used as the wrapper, as it provides
the most flexibility for placement of elements before, after, or inside
of its HTML tags. This property is required for using AJAX requests in
on a form element. Note that the entire element with this ID is
replaced, not just the contents of the element.</p><p><strong>Values</strong>: String containg a valid id attribute of an HTML element on the same page. This <span style="font-style: italic;">must not contain</span> the '#' character that a selector would have.</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"> $form</span><span class="g-txt">[</span><span class="r-txt">'new'</span><span class="g-txt">][</span><span class="r-txt">'attach'</span><span class="g-txt">] = array(<br /> </span><span class="r-txt">'#type' </span><span class="g-txt">=> </span><span class="r-txt">'submit'</span><span class="g-txt">,<br /> </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">'Attach'</span><span class="g-txt">),<br /> </span><span class="r-txt">'#name' </span><span class="g-txt">=> </span><span class="r-txt">'attach'</span><span class="g-txt">,<br /> </span><span class="r-txt">'#ajax' </span><span class="g-txt">=> array(<br /> </span><span class="r-txt">'path' </span><span class="g-txt">=> </span><span class="r-txt">'upload/js'</span><span class="g-txt">,<br /> </span><span class="r-txt">'wrapper' </span><span class="g-txt">=> </span><span class="r-txt">'attach-wrapper'</span><span class="g-txt">,<br /> </span><span class="r-txt">'progress' </span><span class="g-txt">=> array(</span><span class="r-txt">'type' </span><span class="g-txt">=> </span><span class="r-txt">'bar'</span><span class="g-txt">, </span><span class="r-txt">'message' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Please wait...'</span><span class="g-txt">)),<br /> ),<br /> </span><span class="r-txt">'#submit' </span><span class="g-txt">=> array(</span><span class="r-txt">'node_form_submit_build_node'</span><span class="g-txt">),<br /> );<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="#tableselect">tableselect</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"><?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">=></span> <span class="g-txt">array(</span><span class="r-txt">'search-form'</span><span class="g-txt">));<br /></span><span class="b-txt">?></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"><?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 />
'#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">'Authored by'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#maxlength'</span> <span class="g-txt">=></span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#autocomplete_path'</span> <span class="g-txt">=></span> <span class="r-txt">'user/autocomplete'</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">name</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#weight'</span> <span class="g-txt">=> -</span><span class="b-txt">1,<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?></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"><?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 />
'#input'</span> <span class="g-txt">=></span> <span class="b-txt">TRUE</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#name'</span> <span class="g-txt">=></span> <span class="r-txt">'op'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#button_type'</span> <span class="g-txt">=></span> <span class="r-txt">'submit'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#submit'</span> <span class="g-txt">=></span> <span class="b-txt">TRUE,<br /></span><span class="g-txt">);<br /></span><span class="b-txt">?></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"><?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 />
'#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">'Block configuration'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#weight'</span> <span class="g-txt">=></span> <span class="b-txt">3</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">,</span> <span class="r-txt"><br />
'#tree'</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="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"><?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 />
'#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">'Block configuration'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#weight'</span> <span class="g-txt">=></span> <span class="b-txt">3</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">,</span> <span class="r-txt"><br />
'#tree'</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="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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">] = array(<br />
</span><span class="r-txt">'#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">'Description'</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">'description'</span><span class="g-txt">],</span> <span class="r-txt"><br />
'#cols'</span> <span class="g-txt">=></span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#rows'</span> <span class="g-txt">=></span> <span class="b-txt">5</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></span></span></code>
</div>
<h3><a name="default_tab" id="default_tab"></a>#default_tab</h3>
<p><strong>Used by</strong>: <a href="#vertical_tabs">vertical_tabs</a></p>
<p><strong>Description</strong>: The default tab to have open.</p>
<p><strong>Values</strong>: Text giving the array key of the default tab.</p>
<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="#tableselect">tableselect</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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'body'</span><span class="g-txt">] = array(<br />
</span> <span class="r-txt">'#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</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></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 =>
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"><?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>
<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"><?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>
<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.</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"><?php<br />
</span> <span class="g-txt">if (isset(</span><span class="b-txt">$disabled</span><span class="g-txt">[</span><span class="b-txt">$name</span><span class="g-txt">])) {<br />
</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">] = </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="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 class="g-txt">function </span><span class="b-txt">myelement_validate</span><span class="g-txt">(</span><span class="b-txt">$element</span><span class="g-txt">, &</span><span class="b-txt">$form_state</span><span class="g-txt">) {<br />
if (empty(</span><span class="b-txt">$element</span><span class="g-txt">[</span><span class="r-txt">'#value'</span><span class="g-txt">])) {<br />
</span><span class="b-txt">form_error</span><span class="g-txt">(</span><span class="b-txt">$element</span><span class="g-txt">, </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'This field is required.'</span><span class="g-txt">));<br />
}<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 class="def-txt"><span class="b-txt"><?php<br />
</span><span class="g-txt">if (</span><span class="b-txt">count</span><span class="g-txt">(</span><span class="b-txt">$formats</span><span class="g-txt">) > </span><span class="b-txt">1</span><span class="g-txt">) {<br />
</span><span class="b-txt">$form </span><span class="g-txt">= array(<br />
</span><span class="r-txt">'#type' </span><span class="g-txt">=> </span><span class="r-txt">'fieldset'</span><span class="g-txt">,<br />
</span><span class="r-txt">'#title' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Input format'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#collapsible' </span><span class="g-txt">=> </span><span class="b-txt">TRUE</span><span class="g-txt">,<br />
</span><span class="r-txt">'#collapsed' </span><span class="g-txt">=> </span><span class="b-txt">TRUE</span><span class="g-txt">,<br />
</span><span class="r-txt">'#weight' </span><span class="g-txt">=> </span><span class="b-txt">$weight</span><span class="g-txt">,<br />
</span><span class="r-txt">'#element_validate' </span><span class="g-txt">=> array(</span><span class="r-txt">'filter_form_validate'</span><span class="g-txt">),<br />
);<br />
...<br />
</span><span class="b-txt">?></span>
</span></code>
</div>
<h3><a name="empty" id="empty"></a>#empty</h3>
<p class="help"><strong>Used by</strong>: <a href="#tableselect">tableselect</a></p>
<p><strong>Description</strong>: Text to display if the #options property is empty.</p>
<p><strong>Values</strong>: Text, enclosed in the t() translation function.</p>
<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 button should submit the form.</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 class="def-txt"><span class="b-txt"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'site_403'</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">'#title' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Default 403 (access denied) page'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#default_value' </span><span class="g-txt">=> </span><span class="b-txt">variable_get</span><span class="g-txt">(</span><span class="r-txt">'site_403'</span><span class="g-txt">, </span><span class="r-txt">''</span><span class="g-txt">),<br />
</span><span class="r-txt">'#size' </span><span class="g-txt">=> </span><span class="b-txt">40</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">'This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#field_prefix' </span><span class="g-txt">=> </span><span class="b-txt">url</span><span class="g-txt">(</span><span class="b-txt">NULL</span><span class="g-txt">, </span><span class="b-txt">NULL</span><span class="g-txt">, </span><span class="b-txt">NULL</span><span class="g-txt">, </span><span class="b-txt">TRUE</span><span class="g-txt">) . (</span><span class="b-txt">variable_get</span><span class="g-txt">(</span><span class="r-txt">'clean_url'</span><span class="g-txt">, </span><span class="b-txt">0</span><span class="g-txt">) ? </span><span class="r-txt">'' </span><span class="g-txt">: </span><span class="r-txt">'?q='</span><span class="g-txt">)<br />
);<br /></span><span class="b-txt">?></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 class="def-txt"><span class="b-txt"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'settings_general'</span><span class="g-txt">][</span><span class="r-txt">'upload_usersize_default'</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">'#title' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Default total file size per user'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#default_value' </span><span class="g-txt">=> </span><span class="b-txt">$upload_usersize_default</span><span class="g-txt">,<br />
</span><span class="r-txt">'#size' </span><span class="g-txt">=> </span><span class="b-txt">5</span><span class="g-txt">,<br />
</span><span class="r-txt">'#maxlength' </span><span class="g-txt">=> </span><span class="b-txt">5</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">'The default maximum size of all files a user can have on the site.'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#field_suffix' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'MB'</span><span class="g-txt">)<br />
);</span></span></code>
</div>
<h3><a name="header" id="header"></a>#header</h3>
<p class="help"><strong>Used by</strong>: <a href="#tableselect">tableselect</a></p>
<p><strong>Description</strong>: Column headers.</p>
<p><strong>Values</strong>:
Associative array where the keys are the field names to use for each
column, and the values are the translated text to display for each
column header.</p>
<h3><a name="js_select" id="js_select"></a>#js_select</h3>
<p class="help"><strong>Used by</strong>: <a href="#tableselect">tableselect</a></p>
<p><strong>Description</strong>: Whether to include a select all checkbox.</p>
<p><strong>Values</strong>:
TRUE to add a select all box to each row of the table, FALSE to omit
the select all box. Only applies if #multiple is also TRUE.</p>
<h3><a name="markup-attribute" id="markup-attribute"></a>#markup</h3>
<p><strong>Used by</strong>: <a href="#item">item</a>, <a href="#markup">markup</a></p>
<p><strong>Description</strong>: Used to set HTML that will be output on the form.</p>
<p><strong>Values</strong>: Text (valid HTML)</p>
<p><strong>Usage example</strong> (<a href="http://api.drupal.org/api/file/modules/contact/contact.pages.inc">contact.module</a>):</p>
<div class="codeblock">
<code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"><?php<br />
$form</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'from'</span><span style="color: rgb(0, 119, 0);">] = array(<br />
</span><span style="color: rgb(221, 0, 0);">'#type' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(221, 0, 0);">'item'</span><span style="color: rgb(0, 119, 0);">,<br />
</span><span style="color: rgb(221, 0, 0);">'#title' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(0, 0, 187);">t</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'From'</span><span style="color: rgb(0, 119, 0);">),<br />
</span><span style="color: rgb(221, 0, 0);">'#markup' </span><span style="color: rgb(0, 119, 0);">=> </span><span style="color: rgb(0, 0, 187);">check_plain</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$user</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">name</span><span style="color: rgb(0, 119, 0);">) . </span><span style="color: rgb(221, 0, 0);">' &lt;' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">check_plain</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$user</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">mail</span><span style="color: rgb(0, 119, 0);">) . </span><span style="color: rgb(221, 0, 0);">'&gt;'</span><span style="color: rgb(0, 119, 0);">,<br />
);<br />
</span><span style="color: rgb(0, 0, 187);">?></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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'title'</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">,</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="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"><?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">?></span></span></code>
</div>
<h3><a name="multiple" id="multiple"></a>#multiple</h3>
<p><strong>Used by</strong>: <a href="#select">select</a>, <a href="#tableselect">tableselect</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"><?php<br /></span> <span class="g-txt">return array(</span><span class="r-txt"><br />
'#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">$title</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$value</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#options'</span> <span class="g-txt">=></span> <span class="b-txt">$options</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#description'</span> <span class="g-txt">=></span> <span class="b-txt">$description</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#multiple'</span> <span class="g-txt">=></span> <span class="b-txt">$multiple</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#size'</span> <span class="g-txt">=></span> <span class="b-txt">$multiple</span> <span class="g-txt">?</span><span class="r-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><span class="g-txt">:</span> <span class="b-txt">0</span><span class="g-txt">,<br />
</span><span class="r-txt">'#weight'</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 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>, <a href="#tableselect">tableselect</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' => t('Display Value 1'), 'return_value2' => 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"><?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="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"><?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 />
</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 />
'#parents'</span> <span class="g-txt">=> array(</span><span class="r-txt">'status'</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">'Status'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$status</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">'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 />
'#weight'</span> <span class="g-txt">=> -</span><span class="b-txt">1</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></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 href="http://api.drupal.org/api/function/drupal_render/" class="local">drupal_render</a>() has occured.</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"><?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">?></span></span></code>
<p>This example would call admin_form_html_cleanup($content, $elements) after $elements have 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 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"><?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 />
'#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">'Choices'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#prefix'</span> <span class="g-txt">=></span> <span class="r-txt">'<div class="poll-form">'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#suffix'</span> <span class="g-txt">=></span> <span class="r-txt">'</div>'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#tree'</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="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 href="http://api.drupal.org/api/function/drupal_render/" class="local">drupal_render</a>() has occured.</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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'admin'</span><span class="g-txt">][</span><span class="r-txt">'#pre_render'</span><span class="g-txt">] = array(</span><span class="r-txt">'admin_form_tab_errors'</span><span class="g-txt">);<br />
</span><span class="b-txt">?></span></span></code>
<p>This example would call admin_form_tab_errors($elements) before $elements have been rendered via <a href="http://api.drupal.org/api/function/drupal_render/" class="local">drupal_render</a>(). $elements may then be modified and 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>Used by</strong>: All</p>
<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 class="b-txt">$type</span><span class="g-txt">[</span><span class="r-txt">'radios'</span><span class="g-txt">] = array(</span><span class="r-txt">'#input' </span><span class="g-txt">=> </span><span class="b-txt">TRUE</span><span class="g-txt">, </span><span class="r-txt">'#process' </span><span class="g-txt">=> array(</span><span class="r-txt">'expand_radios'</span><span style="color: rgb(0, 119, 0);">));</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/url" class="local">url</a>(). 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"><?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">?></span></span></code></p>
<p><code><span class="def-txt"><span class="b-txt"><?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'</span><span class="g-txt">);<br /></span><span class="b-txt">?></span></span></code></p>
<p><code><span class="def-txt"><span class="b-txt"><?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">?></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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'title'</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">,</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="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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'morechoices'</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">=></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 />
'#return_value'</span> <span class="g-txt">=></span> <span class="b-txt">1</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">0</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">"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">?></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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">] = array(<br />
</span><span class="r-txt">'#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">'Description'</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">'description'</span><span class="g-txt">],</span> <span class="r-txt"><br />
'#cols'</span> <span class="g-txt">=></span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#rows'</span> <span class="g-txt">=></span> <span class="b-txt">5</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></span></span></code>
</div>
<h3><a name="size" id="size"></a>#size</h3>
<p><strong>Used by</strong>: <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"><?php<br />
$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 />
</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">'#title'</span> <span class="g-txt">=></span> <span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Homepage'</span><span class="g-txt">),<br />
</span> <span class="r-txt">'#maxlength'</span> <span class="g-txt">=></span> <span class="b-txt">255</span><span class="g-txt">,<br />
</span> <span class="r-txt">'#size'</span> <span class="g-txt">=></span> <span class="b-txt">30</span><span class="g-txt">,<br />
</span> <span class="r-txt">'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$edit</span><span class="g-txt">[</span><span class="r-txt">'homepage'</span><span class="g-txt">],<br />
);<br /></span><span class="b-txt">?></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_property" id="submit_property"></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 class="def-txt"><span class="b-txt"><?php<br />
</span><span class="g-txt">function </span><span class="b-txt">menu_form_alter</span><span class="g-txt">(&</span><span class="b-txt">$form</span><span class="g-txt">, </span><span class="b-txt">$form_state</span><span class="g-txt">, </span><span class="b-txt">$form_id</span><span class="g-txt">) {<br />
... <br />
</span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'menu'</span><span class="g-txt">][</span><span class="r-txt">'parent'</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">,<br />
</span><span class="r-txt">'#title' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Parent item'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#default_value' </span><span class="g-txt">=> </span><span class="b-txt">$default</span><span class="g-txt">,<br />
</span><span class="r-txt">'#options' </span><span class="g-txt">=> </span><span class="b-txt">$options</span><span class="g-txt">,<br />
</span><span class="r-txt">'#attributes' </span><span class="g-txt">=> array(</span><span class="r-txt">'class' </span><span class="g-txt">=> </span><span class="r-txt">'menu-title-select'</span><span class="g-txt">),<br />
);<br />
</span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'#submit'</span><span class="g-txt">][] = </span><span class="r-txt">'menu_node_form_submit'</span><span class="g-txt">;<br />
}<br />
</span><span class="b-txt">?></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 class="def-txt"><span class="b-txt"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'menu_name'</span><span class="g-txt">] = array(</span><span class="r-txt">'#type' </span><span class="g-txt">=> </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">$menu</span><span class="g-txt">[</span><span class="r-txt">'menu_name'</span><span class="g-txt">]);<br />
</span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'#insert'</span><span class="g-txt">] = </span><span class="b-txt">FALSE</span><span class="g-txt">;<br />
</span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'delete'</span><span class="g-txt">] = array(<br />
</span><span class="r-txt">'#type' </span><span class="g-txt">=> </span><span class="r-txt">'submit'</span><span class="g-txt">,<br />
</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">'Delete'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#access' </span><span class="g-txt">=> !</span><span class="b-txt">in_array</span><span class="g-txt">(</span><span class="b-txt">$menu</span><span class="g-txt">[</span><span class="r-txt">'menu_name'</span><span class="g-txt">], </span><span class="b-txt">menu_list_system_menus</span><span class="g-txt">()),<br />
</span><span class="r-txt">'#submit' </span><span class="g-txt">=> array(</span><span class="r-txt">'menu_custom_delete_submit'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#weight' </span><span class="g-txt">=> </span><span class="b-txt">10</span><span class="g-txt">,<br />
);<br />
</span><span class="b-txt">?></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"><?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 />
'#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">'Choices'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#prefix'</span> <span class="g-txt">=></span> <span class="r-txt">'<div class="poll-form">'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#suffix'</span> <span class="g-txt">=></span> <span class="r-txt">'</div>'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#tree'</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="text_format" id="text_format"></a>#text_format</h3>
<p><strong>Used by</strong>: <a href="#textarea">textarea</a>, <a href="#textfield">textfield</a></p>
<p><strong>Description</strong>:
Specifies the input format used by default for the field. Drupal will
automatically expand the element to a 'value' and a 'format' element
later.</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">
<p><code><span class="def-txt"><span class="b-txt"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'comment'</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">'Comment'</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$default</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#text_format'</span> <span class="g-txt">=></span> <span class="g-txt">isset(</span><span class="b-txt">$edit</span><span class="g-txt">-></span><span class="b-txt">format</span><span class="g-txt">) ? </span><span class="b-txt">$edit</span><span class="g-txt">-></span><span class="b-txt">format</span><span class="g-txt"> : </span><span class="b-txt">FILTER_FORMAT_DEFAULT</span><span class="g-txt">)</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="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. It must render this element and all of its child elements.</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"><?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">?></span></span></code>
</div>
<h3><a name="theme_wrappers" id="theme_wrappers"></a>#theme_wrappers</h3>
<p><strong>Used by</strong>: All elements and forms.</p>
<p><strong>Description</strong>: Theme function to call for element, after the element and children are rendered, but before the <a href="#post_render">#post_render</a> functions are called.</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/system/system.module">system.module</a> from definition of default properties for a form):</p>
<div class="codeblock">
<code><span class="def-txt"><span class="b-txt"><?php<br />
$type<span class="g-txt">[</span><span class="r-txt">'form'</span><span class="g-txt">] = array(</span> <span class="r-txt">'#theme_wrappers'</span><span class="g-txt"> =></span><span class="r-txt">'form'</span><span class="g-txt"> );</span>
<br /></span><span class="b-txt">?></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"><?php<br />
$form</span><span class="g-txt">[</span><span class="r-txt">'description'</span><span class="g-txt">] = array(<br />
</span><span class="r-txt">'#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">'Description'</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">'description'</span><span class="g-txt">],</span> <span class="r-txt"><br />
'#cols'</span> <span class="g-txt">=></span> <span class="b-txt">60</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#rows'</span> <span class="g-txt">=></span> <span class="b-txt">5</span><span class="g-txt">,<br />
);<br /></span><span class="b-txt">?></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"><?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 />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'checkboxes'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#default_value'</span> <span class="g-txt">=></span> <span class="b-txt">$status</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#options'</span> <span class="g-txt">=></span> <span class="b-txt">$options</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#tree'</span> <span class="g-txt">=></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"> $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 />
'#type'</span> <span class="g-txt">=></span> <span class="r-txt">'hidden'</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#value'</span> <span class="g-txt">=></span> <span class="b-txt">1</span><span class="g-txt">,</span> <span class="r-txt"><br />
'#suffix'</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 />
}<br /></span><span class="b-txt">?></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="#tableselect">tableselect</a>, <a href="#textarea">textarea</a>, <a href="#textfield">textfield</a>, <a href="#token">token</a>, <a href="#val">value</a>, <a href="#vertical_tabs">vertical_tabs</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"><?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="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">&$form_state</span><span class="g-txt">) {<br />
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 />
</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 />
}<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 class="def-txt"><span class="b-txt"><?php<br />
</span><span class="y-txt">// Node types:<br />
</span><span class="b-txt">$types </span><span class="g-txt">= </span><span class="b-txt">array_map</span><span class="g-txt">(</span><span class="r-txt">'check_plain'</span><span class="g-txt">, </span><span class="b-txt">node_get_types</span><span class="g-txt">(</span><span class="r-txt">'names'</span><span class="g-txt">));<br />
</span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'advanced'</span><span class="g-txt">][</span><span class="r-txt">'type'</span><span class="g-txt">] = array(<br />
</span><span class="r-txt">'#type' </span><span class="g-txt">=> </span><span class="r-txt">'checkboxes'</span><span class="g-txt">,<br />
</span><span class="r-txt">'#title' </span><span class="g-txt">=> </span><span class="b-txt">t</span><span class="g-txt">(</span><span class="r-txt">'Only of the type(s)'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#prefix' </span><span class="g-txt">=> </span><span class="r-txt">'<div class="criterion">'</span><span class="g-txt">,<br />
</span><span class="r-txt">'#suffix' </span><span class="g-txt">=> </span><span class="r-txt">'</div>'</span><span class="g-txt">,<br />
</span><span class="r-txt">'#options' </span><span class="g-txt">=> </span><span class="b-txt">$types</span><span class="g-txt">,<br />
);<br />
</span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'advanced'</span><span class="g-txt">][</span><span class="r-txt">'submit'</span><span class="g-txt">] = array(<br />
</span><span class="r-txt">'#type' </span><span class="g-txt">=> </span><span class="r-txt">'submit'</span><span class="g-txt">,<br />
</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">'Advanced search'</span><span class="g-txt">),<br />
</span><span class="r-txt">'#prefix' </span><span class="g-txt">=> </span><span class="r-txt">'<div class="action">'</span><span class="g-txt">,<br />
</span><span class="r-txt">'#suffix' </span><span class="g-txt">=> </span><span class="r-txt">'</div>'</span><span class="g-txt">,<br />
);<br />
<br />
</span><span class="b-txt">$form</span><span class="g-txt">[</span><span class="r-txt">'#validate'</span><span class="g-txt">][] = </span><span class="r-txt">'node_search_validate'</span><span class="g-txt">;<br />
</span><span class="b-txt">?></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="#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"><?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="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"><?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"> '#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">'Parent'</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">parent</span> <span class="g-txt">?</span> <span class="b-txt">$node</span><span class="g-txt">-></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 />
'#options'</span> <span class="g-txt">=></span> <span class="b-txt">book_toc</span><span class="g-txt">(</span><span class="b-txt">$node</span><span class="g-txt">-></span><span class="b-txt">nid</span><span class="g-txt">),</span> <span class="r-txt"><br />
'#weight'</span> <span class="g-txt">=> -</span><span class="b-txt">15</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">'The
parent that this page belongs in. Note that pages whose parent is
&lt;top-level&gt; are regarded as independent, top-level books.'</span><span class="g-txt">),<br />
);<br /></span><span class="b-txt">?></span></span></code>
</div>
</body></html>