Form generation

Functions to enable output of HTML forms and form elements.

Drupal uses these functions to achieve consistency in its form presentation, while at the same time simplifying code and reducing the amount of HTML that must be explicitly generated by modules. See the reference at http://api.drupal.org/api/HEAD/file/developer/topics/forms_api_reference... and the quickstart guide at http://api.drupal.org/api/HEAD/file/developer/topics/forms_api.html

Functions

NameLocationDescription
checkboxes_valueincludes/form.incHelper function to load value from default value for checkboxes
date_validateincludes/form.incValidates the FAPI date type to stop dates like 30/Feb/2006
drupal_get_formincludes/form.incProcesses a form array and produces the HTML output of a form. If there is input in the $_POST['edit'] variable, this function will attempt to validate it, using drupal_validate_form(), and then submit the form using drupal_submit_form().
element_childincludes/form.incCheck if the key is a child.
element_childrenincludes/form.incGet keys of a form tree element that are not properties (i.e., do not begin with '#').
element_propertiesincludes/form.incGet properties of a form tree element. Properties begin with '#'.
element_propertyincludes/form.incCheck if the key is a property.
expand_dateincludes/form.incRoll out a single date element.
expand_radiosincludes/form.incRoll out a single radios element to a list of radios, using the options array as index.
form_builderincludes/form.incAdds some required properties to each form element, which are used internally in the form api. This function also automatically assigns the value property from the $edit array, provided the element doesn't already have an assigned value.
form_clean_idincludes/form.incRemove invalid characters from an HTML ID attribute string.
form_errorincludes/form.incFlag an element as having an error.
form_get_errorincludes/form.incReturn the error message filed against the form with the specified name.
form_get_errorsincludes/form.incReturn an associative array of all errors.
form_renderincludes/form.incRenders a HTML form given a form tree. Recursively iterates over each of the form elements, generating HTML code. This function is usually called from within a theme. To render a form from within a module, use drupal_get_form().
form_set_errorincludes/form.incFile an error against a form element. If the name of the element is edit[foo][bar] then you may pass either foo or foo][bar as $name foo will set an error for all its children.
form_set_valueincludes/form.incUse this function to make changes to form values in the form validate phase, so they will be available in the submit phase in $form_values.
map_monthincludes/form.incHelper function for usage with drupal_map_assoc to display month names.
password_confirm_validateincludes/form.incValidate password_confirm element.
theme_checkboxincludes/form.incFormat a checkbox.
theme_checkboxesincludes/form.incFormat a set of checkboxes.
theme_dateincludes/form.incFormat a date selection element.
theme_fieldsetincludes/form.incFormat a group of form items.
theme_fileincludes/form.incFormat a file upload field.
theme_formincludes/form.incFormat a form.
theme_hiddenincludes/form.incFormat a hidden form field.
theme_itemincludes/form.incFormat a form item.
theme_passwordincludes/form.incFormat a password field. * *
theme_password_confirmincludes/form.incFormat a password_confirm item.
theme_radioincludes/form.incFormat a radio button.
theme_radiosincludes/form.incFormat a set of radio buttons.
theme_selectincludes/form.incFormat a dropdown menu or scrolling selection box.
theme_textareaincludes/form.incFormat a textarea.
theme_textfieldincludes/form.incFormat a textfield.
theme_weightincludes/form.incFormat a weight selection menu.
weight_valueincludes/form.incIf no default value is set for weight select boxes, use 0.
_element_infoincludes/form.incRetrieve the default properties for the defined element type.
_form_set_classincludes/form.incSets a form element's class attribute.
_form_set_valueincludes/form.incHelper function for form_set_value().
_form_sortincludes/form.incFunction used by uasort in form_render() to sort form by weight.