Same name and namespace in other branches
- 6.x-1.x form_example/form_example_tutorial.inc \form_example_tutorial_1()
Tutorial Example 1.
This first form function is from the Form Tutorial handbook page
It just creates a very basic form with a textfield.
This function is called the "form constructor function". It builds the form. It takes a two arguments, $form and $form_state, but if drupal_get_form() sends additional arguments, they will be provided after $form_state.
Related topics
1 string reference to 'form_example_tutorial_1'
- form_example_menu in form_example/
form_example.module - Implements hook_menu().
File
- form_example/
form_example_tutorial.inc, line 49 - This is the Form API Tutorial from the handbook.
Code
function form_example_tutorial_1($form, &$form_state) {
$form['description'] = array(
'#type' => 'item',
'#title' => t('A form with nothing but a textfield'),
);
// This is the first form element. It's a textfield with a label, "Name"
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
);
return $form;
}