1 ajax_example_graceful_degradation.inc ajax_example_dependent_dropdown_degrades_submit($form, &$form_state)

Submit function for ajax_example_dependent_dropdown_degrades().

Related topics

File

modules/examples/ajax_example/ajax_example_graceful_degradation.inc, line 129
Demonstrations of AJAX with graceful degradation.

Code

function ajax_example_dependent_dropdown_degrades_submit($form, &$form_state) {

  // Now handle the case of the next, previous, and submit buttons.
  // only submit will result in actual submission, all others rebuild.
  switch ($form_state['triggering_element']['#value']) {
    case t('OK'):
      // Submit: We're done.
      backdrop_set_message(t('Your values have been submitted. dropdown_first=@first, dropdown_second=@second', array('@first' => $form_state['values']['dropdown_first'], '@second' => $form_state['values']['dropdown_second'])));
      return;
  }
  // 'Choose' or anything else will cause rebuild of the form and present
  // it again.
  $form_state['rebuild'] = TRUE;
}