You are here

function webform_civicrm_ahah_callback in Webform CiviCRM Integration 6.2

Callback to return relevant portion of a form during AHAH processing.

1 call to webform_civicrm_ahah_callback()
webform_civicrm_js_options in ./webform_civicrm_utils.inc
Callback to serve AJAX requests.

File

./webform_civicrm_d6_functions.inc, line 18
Keep all functions specific to a version of Drupal here, to allow the rest of the code to be version-independent.

Code

function webform_civicrm_ahah_callback($key) {
  $snippet = webform_civicrm_process_ahah_form();

  // Isolate the portion of form to fetch (nested array keys are encoded as a . separated string)
  $keys = explode('.', substr($key, 13));
  foreach ($keys as $key) {
    $snippet = $snippet[$key];
  }
  unset($snippet['#prefix'], $snippet['#suffix']);
  $messages = theme('status_messages');
  $output = drupal_render($snippet);
  exit(drupal_json(array(
    'data' => $output,
  )));
}