This page provides a programmer's reference to the Backdrop CMS Form API. For a brief introduction on how to create forms, see the Form generation guide. For more extensive information about the Form API, see the Form API handbook (Drupal 7 documentation).

Skip to: Default Values | Elements | Properties

Simple Elements

buttoncheckboxcheckboxescolordateemailhiddenhtml_datehtml_timenumberpasswordradioradiossearchselectsubmitteltextareatextfieldurlvalue
#access✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#after_build✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#ajax✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#allow_focus✓
#array_parents✓✓✓✓✓
#attached✓✓✓✓✓
#attributes✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#autocomplete_path✓✓✓✓✓✓
#button_type✓✓
#cols✓
#default_value✓✓✓✓✓✓✓✓✓✓✓✓✓
#description✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#description_display✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#disabled✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#element_validate✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#empty_option✓
#empty_value✓
#executes_submit_callback✓✓
#field_prefix✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#field_suffix✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#id✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#indentation✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#input✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#limit_validation_errors✓✓
#max✓
#maxlength✓✓✓✓✓✓
#min✓
#multiple✓
#name✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#options✓✓✓
#parents✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#password_shown✓
#password_strength✓
#password_toggle✓
#placeholder✓✓✓✓✓✓✓✓
#post_render✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#prefix✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#pre_render✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#process✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#required✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#required_message✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#resizable✓
#return_value✓✓
#rows✓
#size✓✓✓✓✓✓✓✓
#states✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#step✓
#submit✓✓
#suffix✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#theme✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#theme_wrappers✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#title✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#title_display✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#token_types✓✓✓✓✓
#tree✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#type✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#validate✓✓
#value✓✓✓✓✓
#value_callback✓✓✓✓✓
#weight✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#wrapper_attributes✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓

Structural Elements

actionsajaxcontainerdetailsfieldsetformitemtokenvertical_tabs
#access✓✓✓✓✓✓✓✓
#action✓
#after_build✓✓✓✓✓✓✓✓
#attached✓
#attributes✓✓✓✓✓✓✓
#children✓✓✓
#collapsed✓
#collapsible✓
#commands✓
#config✓
#default_tab✓
#default_value✓
#description✓✓
#description_display✓✓
#details✓
#element_validate✓✓✓✓
#error✓
#field_prefix✓
#field_suffix✓
#group✓
#header✓
#https✓
#id✓✓✓✓✓✓✓
#indentation✓
#input✓✓✓
#markup✓
#method✓
#name✓
#open✓
#parents✓✓✓✓✓✓
#post_render✓✓✓✓✓✓✓✓
#prefix✓✓✓✓✓✓✓
#pre_render✓✓✓✓✓✓✓✓
#process✓✓✓✓✓✓✓✓
#redirect✓
#required✓✓✓✓✓
#states✓✓✓✓✓✓✓
#submit✓
#suffix✓✓✓✓✓✓✓
#summary✓
#theme✓✓✓✓✓✓✓✓
#theme_wrappers✓✓✓✓✓✓✓✓✓
#title✓✓
#title_display✓✓✓✓✓✓
#token_types✓✓
#tree✓✓✓✓✓✓✓
#type✓✓✓✓✓✓✓
#validate✓
#value✓✓
#weight✓✓✓✓✓✓✓✓✓
#wrapper_attributes✓

Complex Elements

date_popupdate_selectdate_textfield_ui_tablefilehtml_datetimeimage_buttonlink_fieldmachine_namemanaged_fileoptionspassword_confirmrangetableselecttext_formatweight
#access✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#after_build✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#ajax✓✓✓✓✓✓✓✓
#array_parents✓✓✓✓✓✓
#attached✓✓✓✓✓✓✓
#attributes✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#autocomplete_path✓
#base_type✓
#browser_view✓
#button_type✓
#children✓
#cols✓
#datepicker_options✓
#date_flexible✓✓✓
#date_format✓✓✓
#date_increment✓✓✓
#date_label_position✓✓✓
#date_text_parts✓✓✓
#date_timezone✓✓✓
#date_year_range✓✓✓
#default_value✓✓✓✓✓✓✓✓
#default_value_allowed✓
#default_value_pattern✓
#delta✓
#description✓✓✓✓✓✓✓✓✓✓✓✓✓
#description_display✓✓✓✓✓✓✓✓✓✓✓✓✓
#disabled✓✓✓✓✓✓✓✓✓✓✓
#editor_uploads✓
#element_validate✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#empty✓
#executes_submit_callback✓
#extended✓
#field_prefix✓✓✓✓✓✓✓✓✓✓✓
#field_suffix✓✓✓✓✓✓✓✓✓✓✓
#format✓
#has_garbage_value✓
#header✓
#id✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#indentation✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#input✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#js_select✓
#key_type✓
#key_type_toggle✓
#key_type_toggled✓
#limit✓
#limit_validation_errors✓
#max✓
#maxlength✓✓
#min✓
#multiple✓✓✓
#name✓✓✓✓✓✓✓✓✓✓✓✓
#optgroups✓
#options✓✓
#options_readonly✓
#parents✓✓✓✓✓✓✓✓✓✓✓✓
#parent_options✓
#post_render✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#prefix✓✓✓✓✓✓✓✓✓✓✓✓✓
#pre_render✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#process✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#progress_indicator✓
#progress_message✓
#regions✓
#required✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#required_message✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#resizable✓
#return_value✓
#rows✓
#size✓✓✓✓✓
#src✓
#states✓✓✓✓✓✓✓✓✓✓✓✓
#step✓
#submit✓
#suffix✓✓✓✓✓✓✓✓✓✓✓✓✓
#theme✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#theme_wrappers✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#timepicker✓✓✓
#title✓✓✓✓✓✓✓✓✓✓✓✓✓
#title_display✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#token_types✓
#tree✓✓✓✓✓✓✓✓✓✓✓✓
#type✓✓✓✓✓✓✓✓✓✓✓✓
#upload_location✓
#upload_validators✓
#validate✓
#value✓
#value_callback✓✓✓✓✓
#weight✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
#wrapper_attributes✓✓✓✓✓✓✓✓✓✓✓

Renderable Elements (not limited to forms)

contextual_linksdropbuttonhead_taghelplinkmarkupoperationsscriptsstyles
#access✓✓✓✓✓✓✓✓✓
#after_build✓✓✓✓✓✓✓✓
#aggregate_callback✓✓
#ajax✓
#attached✓
#attributes✓✓✓✓✓✓✓
#disabled✓✓
#element_validate✓
#group_callback✓✓
#href✓
#id✓✓✓✓✓
#input✓✓✓✓
#items✓✓
#links✓✓✓
#markup✓✓
#options✓
#parents✓✓✓✓
#post_render✓✓✓✓✓✓✓✓
#prefix✓✓✓✓✓✓
#pre_render✓✓✓✓✓✓✓✓✓
#process✓✓✓✓✓✓✓✓
#required✓✓✓✓
#states✓✓✓
#suffix✓✓✓✓✓✓
#tag✓
#theme✓✓✓✓✓✓✓✓✓
#theme_wrappers✓✓✓✓✓✓✓✓✓
#title✓
#title_display✓✓✓✓
#token_types✓✓
#tree✓✓✓✓
#type✓✓✓✓✓✓
#value✓✓
#weight✓✓✓✓✓✓✓✓✓

Default values

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

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

actions

ajax

button

checkbox

checkboxes

color

container

contextual_links

date

date_popup

date_select

date_text

details

dropbutton

email

fieldset

field_ui_table

file

form

head_tag

help

hidden

html_date

html_datetime

html_time

image_button

item

link

  • #pre_render = array('backdrop_pre_render_link', 'backdrop_pre_render_markup')

link_field

machine_name

managed_file

markup

number

operations

  • #pre_render = array('backdrop_pre_render_dropbutton')
  • #theme = links__dropbutton__operations

options

password

password_confirm

radio

radios

range

scripts

search

select

styles

submit

tableselect

tel

textarea

textfield

text_format

token

url

vertical_tabs

weight

Elements

Properties