form_example_tutorial_8_page_two

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

Returns the form for the second page of form_example_tutorial_8().

1 call to form_example_tutorial_8_page_two()

File

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

Code

function form_example_tutorial_8_page_two($form, &$form_state) {
  $form['description'] = array(
    '#type' => 'item', 
    '#title' => t('A basic multistep form (page 2)'),
  );

  $form['color'] = array(
    '#type' => 'textfield', 
    '#title' => t('Favorite color'), 
    '#required' => TRUE, 
    '#default_value' => !empty($form_state['values']['color']) ? $form_state['values']['color'] : '',
  );
  $form['submit'] = array(
    '#type' => 'submit', 
    '#value' => t('Submit'), 
    '#submit' => array('form_example_tutorial_8_page_two_submit'),
  );
  $form['back'] = array(
    '#type' => 'submit', 
    '#value' => t('<< Back'), 
    '#submit' => array('form_example_tutorial_8_page_two_back'),
    // We won't bother validating the required 'color' field, since they
    // have to come back to this page to submit anyway. 
    '#limit_validation_errors' => array(),
  );
  return $form;
}
Login or register to post comments