drupaldrupal-6drupal-fapidrupal-formsdrupal-ajax

AJAX in Drupal Forms?


How would you go about constructing a step by step form that uses AJAX through Drupal to pull the next form step?

For example,

Step 1:
   I like Baseball
   I don't like Baseball.

When that person clicks on either Like or Don't Like, I want to use AJAX to recognize and pull the next part of the form, remove/hide the first section since its not needed, and present the next section.

Example:

Step 1:
   I like Baseball
   *click
(fade out)


Step 2:
   My favorite team is __________
   The player I like most is __________

What is the best way to do this through Drupal Form API? I know how to build the forms and modules, but I have never used AJAX yet. I know a few things exist out there that are supposed to help, but I wanted to know if anyone here has done it and how they approached it.


Solution

  • You may want to give a look at the AHAH helper module.