AHAH-powered forms were virtually impossible in Drupal 5 (see the note though). In Drupal 6, this is much easier, thanks to the #ahah property. However, it still is really painful to actually use it.
You have to write a menu callback for each AHAH-enabled form item of your form. You have to repeat small variations of this piece of code for each callback:
// Build our new form element. $form_element = _mymodule_add_something_to_form(); // Build the new form. $form_build_id = $_POST['form_build_id']; // Add the new element to the stored form. Without adding the element // to the form, Drupal is not aware of this new elements existence and // will not process it. We retreive the cached form, add the element, // and resave. $form['somewhere']['very']['deep'] = $form_element; '#post' => $_POST, '#programmed' => FALSE, ); // Rebuild the form. // Render the new output. $subform = $form['somewhere']['choice'];
Ok, it does make sense. But it takes some time to get used to – too much – and is a treshold that's big enough for many developers to just not implement AHAH forms. It simply shouldn't
be this hard.
This current approach of AHAH forms in Drupal is time consuming, hard to maintain and hard to write tests for.