Form generation

  1. drupal
    1. 4.6 includes/common.inc
    2. 4.7 includes/form.inc
    3. 5 includes/form.inc

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 & methods

NameDescription
checkboxes_valueHelper function to load value from default value for checkboxes
date_validateValidates the FAPI date type to stop dates like 30/Feb/2006
drupal_get_formProcesses 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().
drupal_submit_form
drupal_validate_form
element_childCheck if the key is a child.
element_childrenGet keys of a form tree element that are not properties (i.e., do not begin with '#').
element_propertiesGet properties of a form tree element. Properties begin with '#'.
element_propertyCheck if the key is a property.
expand_checkboxes
expand_dateRoll out a single date element.
expand_password_confirm
expand_radiosRoll out a single radios element to a list of radios, using the options array as index.
form_builderAdds 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_idRemove invalid characters from an HTML ID attribute string.
form_errorFlag an element as having an error.
form_get_errorReturn the error message filed against the form with the specified name.
form_get_errorsReturn an associative array of all errors.
form_options_flatten
form_renderRenders 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_select_options
form_set_errorFile 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_valueUse 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_monthHelper function for usage with drupal_map_assoc to display month names.
password_confirm_validateValidate password_confirm element.
theme_button
theme_checkboxFormat a checkbox.
theme_checkboxesFormat a set of checkboxes.
theme_dateFormat a date selection element.
theme_fieldsetFormat a group of form items.
theme_fileFormat a file upload field.
theme_formFormat a form.
theme_hiddenFormat a hidden form field.
theme_itemFormat a form item.
theme_markup
theme_passwordFormat a password field. *
theme_password_confirmFormat a password_confirm item.
theme_radioFormat a radio button.
theme_radiosFormat a set of radio buttons.
theme_selectFormat a dropdown menu or scrolling selection box.
theme_submit
theme_textareaFormat a textarea.
theme_textfieldFormat a textfield.
theme_token
theme_weightFormat a weight selection menu.
weight_valueIf no default value is set for weight select boxes, use 0.
_element_infoRetrieve the default properties for the defined element type.
_form_set_classSets a form element's class attribute.
_form_set_valueHelper function for form_set_value().
_form_sortFunction used by uasort in form_render() to sort form by weight.
_form_validate

File

includes/form.inc, line 3

Login or register to post comments