You are here

function ad_form_ahah in Advertisement 6.2

Same name and namespace in other branches
  1. 6.3 ad.module \ad_form_ahah()
  2. 7 ad.module \ad_form_ahah()

Ad type switch AHAH menu handler.

1 string reference to 'ad_form_ahah'
ad_menu in ./ad.module
Implementation of hook_menu().

File

./ad.module, line 813

Code

function ad_form_ahah() {
  $form_state = array(
    'submitted' => FALSE,
  );
  $form_build_id = $_POST['form_build_id'];
  if (!($form = form_get_cache($form_build_id, $form_state))) {
    exit;
  }
  ad_form_add_adtype_elements($form, $_POST['adtype_select']);
  form_set_cache($form_build_id, $form, $form_state);
  $form += array(
    '#post' => $_POST,
    '#programmed' => FALSE,
  );

  // Rebuild the form.
  $form = form_builder($_POST['form_id'], $form, $form_state);
  $option_form = $form['adtype_elements'];
  unset($option_form['#prefix'], $option_form['#suffix']);
  $output = drupal_render($option_form);
  drupal_json(array(
    'status' => TRUE,
    'data' => $output,
  ));
}