views:

151

answers:

2

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.

+1  A: 

usually i am create full form with fieldsets, then control them manually by jquery.
i assume there lot of ready to go modules in drupal, some of these:
http://drupal.org/project/conditional_fields / http://drupal.org/project/multistep
also: http://www.google.ru/search?q=drupal+multistep+ajax+form

Nikit
+1  A: 

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

Wim Leers

related questions