form_example_tutorial_7

6 form_example_tutorial.inc form_example_tutorial_7($form_state)
7 form_example_tutorial.inc form_example_tutorial_7($form, &$form_state)
8 form_example_tutorial.inc form_example_tutorial_7($form, &$form_state)

Example 7: With a submit handler.

From the handbook page: http://drupal.org/node/717740

See also

form_example_tutorial_7_validate()

form_example_tutorial_7_submit()

Related topics

1 string reference to 'form_example_tutorial_7'

File

form_example/form_example_tutorial.inc, line 310
This is the Form API Tutorial from the handbook.

Code

function form_example_tutorial_7($form, &$form_state) {
  $form['description'] = array(
    '#type' => 'item', 
    '#title' => t('A form with a submit handler'),
  );
  $form['name'] = array(
    '#type' => 'fieldset', 
    '#title' => t('Name'), 
    '#collapsible' => TRUE, 
    '#collapsed' => FALSE,
  );
  $form['name']['first'] = array(
    '#type' => 'textfield', 
    '#title' => t('First name'), 
    '#required' => TRUE, 
    '#default_value' => "First name", 
    '#description' => "Please enter your first name.", 
    '#size' => 20, 
    '#maxlength' => 20,
  );
  $form['name']['last'] = array(
    '#type' => 'textfield', 
    '#title' => t('Last name'), 
    '#required' => TRUE,
  );
  $form['year_of_birth'] = array(
    '#type' => 'textfield', 
    '#title' => "Year of birth", 
    '#description' => 'Format is "YYYY"',
  );
  $form['submit'] = array(
    '#type' => 'submit', 
    '#value' => 'Submit',
  );
  return $form;
}
Login or register to post comments