Submit handler for "Remove name" button on form_example_tutorial_9().

Related topics

1 string reference to 'form_example_tutorial_9_remove_name'
form_example_tutorial_9 in form_example/form_example_tutorial.inc
Example 9: A form with a dynamically added new fields.

File

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

Code

function form_example_tutorial_9_remove_name($form, &$form_state) {
  if ($form_state['num_names'] > 1) {
    $form_state['num_names']--;
  }

  // Setting $form_state['rebuild'] = TRUE causes the form to be rebuilt again.
  $form_state['rebuild'] = TRUE;
}