You are here

function asaf_example_gui_buttons_submit in Asaf (ajax submit for any form) 8

Same name and namespace in other branches
  1. 7 modules/asaf_example/asaf_example.gui.buttons.inc \asaf_example_gui_buttons_submit()

File

modules/asaf_example/asaf_example.gui.buttons.inc, line 51

Code

function asaf_example_gui_buttons_submit($form, &$form_state) {
  $x = trim($form_state['values']['number']);
  switch (end($form_state['clicked_button']['#parents'])) {
    case 'increment':
      drupal_set_message(t('Result: %result', array(
        '%result' => $x + 1,
      )));
      break;
    case 'decrement':
      drupal_set_message(t('Result: %result', array(
        '%result' => $x - 1,
      )));
      break;
    case 'multiply':
      drupal_set_message(t('Result: %result', array(
        '%result' => $x * 2,
      )));
      break;
  }
}