Fix for AHAH callback

  1. function ca_taxonomy_term_js() {
  2.   module_load_include('inc', 'ca', 'ca.admin');
  3.   $form_state = array('storage' => NULL, 'submitted' => FALSE);
  4.   $form_build_id = $_POST['form_build_id'];
  5.   $form = form_get_cache($form_build_id, $form_state);
  6.   $args = $form['#parameters'];
  7.   $form_id = array_shift($args);
  8.   $form['#post'] = $_POST;
  9.   $form['#redirect'] = FALSE;
  10.   $form['#programmed'] = FALSE;
  11.   $form_state['post'] = $_POST;
  12.   drupal_process_form($form_id, $form, $form_state);
  13.   $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  14.  
  15.   // Next line is obviously debugging code ;)
  16.   drupal_json(array('status' => TRUE, 'data' => 'Foo'));
  17.  
  18. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.