You are here

function weather_es_ahah_helper in Weather_es 6.3

Does the very standard things that must be done in any normal callback. Used by each callback in this example module.

@author jmsirvent

1 call to weather_es_ahah_helper()
weather_es_update_cities_js in ./weather_es.module
AHAH for the cities

File

./weather_es.module, line 761

Code

function weather_es_ahah_helper() {

  // From http://drupal.org/node/331941
  $form_state = array(
    'storage' => NULL,
    'submitted' => FALSE,
  );
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);
  $args = $form['#parameters'];
  $form_id = array_shift($args);
  $form_state['post'] = $form['#post'] = $_POST;
  $form['#programmed'] = $form['#redirect'] = FALSE;

  // Enable the submit/validate handlers to determine whether AHAH-submittted.
  $form_state['ahah_submission'] = TRUE;

  // From http://jbenner.net/blog/prevent-ahah-the-right-way-from-breaking-with-validation
  // Stash original form action to avoid overwriting with drupal_rebuild_form().
  $form_state['action'] = $form['#action'];
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  return $form;
}