Community Documentation

ahah_example_callback_helper

6 ahah_example.module ahah_example_callback_helper()

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

Related topics

▾ 4 functions call ahah_example_callback_helper()

ahah_example_autocheckboxes_callback in ahah_example/autocheckboxes.inc
Callback for autocheckboxes. Process the form with the number of checkboxes we want to provide.
ahah_example_autotextfields_callback in ahah_example/autotextfields.inc
ahah_example_dropdown_callback in ahah_example/dependent_dropdown.inc
The AHAH callback. It processes the form using ahah_example_callback_helper() and then
ahah_example_simple_validation_callback in ahah_example/ahah_example_simple_validation.inc
Callback for autocheckboxes. Process the form with the number of checkboxes we want to provide.

File

ahah_example/ahah_example.module, line 127
Demo of some varieties of AHAH in Drupal 6. A tutorial based on this module is at http://randyfay.com/ahah.

Code

<?php
function ahah_example_callback_helper() {
  $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;
  // Enable the submit/validate handlers to determine whether AHAH-submittted.
  $form_state['ahah_submission'] = TRUE;
  $form['#programmed'] = $form['#redirect'] = FALSE;
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  return $form;
}
?>
Login or register to post comments