Fix for AHAH helper - not yet working

  1. <?php
  2.  
  3. function &ahah_helper_get_form_element($form, $parents) {
  4.   // Allow $parents to be either an array of the element's parents or the name
  5.   // of an element.
  6.   if (strpos($parents, ']') !== FALSE) {
  7.     $parents = explode('][', $parents);
  8.   }
  9.  
  10.   // Recursively seek the form element.
  11.   if (count($parents)) {
  12.     $parent = array_shift($parents);
  13.     return ahah_helper_get_form_element($form[$parent], $parents);
  14.   }
  15.   else {
  16.     return $form;
  17.   }
  18. }
  19.  
  20. // Usage:
  21. $form_element &= ahah_helper_get_form_element($form, $form_element_name);
  22.  
  23. // Problem:
  24. // $form_element == int(0)

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.