I'm creating my own application forms, but I can't seem to figure out how to make anything except text fields and text areas. I want to be able to create check boxes (radio buttons), drop down menues, and various other form types.
I was wondering if there was a list or something within one of the handbooks that I've failed to come across that tells you what form types drupal allows you to make.
For example...
$form['contact']['state'] = array(
'#type' => 'textfield',
'#title' => check_plain('State'),
'#required' => TRUE,
'#default_value' => $node->state,
'#weight' => -5
);
This simply creates a text field ('#type' => 'textfield',) asking what state people are from when filling out a contact form. However, if I had wanted to make this a drop down menu of all of the state abbreviations, how would I do that? I would imagine it's something like '#type' => 'dropdownmenu', or something.
Any help would be much appreciated!
twc
Comments
I'm looking for the same info
I'm looking for the same details. A list of form types would be great.
Thanks
Vaughan
Better late than never...
I found this when looking up the same info. Figured I'd pass on what I've found for the next person who finds this. The different types can be found along the top row of the table, here: http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/5
Currently:
checkbox
checkboxes
date
fieldset
file
password
radio
radios
select
textarea
textfield
weight
SPECIAL:
button
form
hidden
markup
item
submit
value
Again, check out the link for details on each type: http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/5
what if i need to make form
what if i need to make form item of type hyperlink?