You are here

function ajaxsubmit_dispatch in Javascript Tools 5

Return form submit result.

2 string references to 'ajaxsubmit_dispatch'
ajaxsubmit_form_alter in ajaxsubmit/ajaxsubmit.module
Implementation of hook_form_alter().
ajaxsubmit_menu in ajaxsubmit/ajaxsubmit.module
Implementation of hook_menu().

File

ajaxsubmit/ajaxsubmit.module, line 149
Make designated forms submit via AJAX.

Code

function ajaxsubmit_dispatch($form_id = NULL, $form = NULL) {
  $result = array(
    'status' => TRUE,
    'data' => array(
      'errors' => form_get_errors(),
      'message' => theme('status_messages'),
      'preview' => isset($form[arg(0) . '_preview']) && !empty($form[arg(0) . '_preview']['#value']) ? $form[arg(0) . '_preview']['#value'] : NULL,
      'destination' => $_SESSION['ajaxsubmit_destination'] ? $_SESSION['ajaxsubmit_destination'] : NULL,
    ),
  );
  print drupal_to_js($result);
  exit;
}