Same name and namespace in other branches
  1. 6.x-1.x form_example/form_example_tutorial.inc \form_example_tutorial_11()

Example 11: adding a confirmation form.

This example generates a simple form that, when submitted, directs the user to a confirmation form generated using the confirm_form function. It asks the user to verify that the name they input was correct

See also

form_example_tutorial_11_submit()

Related topics

1 string reference to 'form_example_tutorial_11'
form_example_menu in form_example/form_example.module
Implements hook_menu().

File

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

Code

function form_example_tutorial_11($form, &$form_state) {

  // This form is identical to the one in example 2 except for one thing: We are
  // adding an #action tag to direct the form submission to a confirmation page.
  $form['description'] = array(
    '#type' => 'item',
    '#title' => t('A set of two forms that demonstrate the confirm_form function.  This form has an explicit action to direct the form to a confirmation page'),
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Submit',
  );
  return $form;
}