AJAX in Drupal Forms?

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-04-30T15:37:01Z Indexed on 2010/04/30 18:07 UTC
Read the original article Hit count: 509

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.

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-ajax

  • drupal ajax create node

    as seen on Stack Overflow - Search for 'Stack Overflow'
    I need to create a drupal node via ajax. I'm looking for some instructions as in: http://stackoverflow.com/questions/960343/creating-a-drupal-node-with-javascript But with more detail, and including the js steps. The JS will probably look something like this: var title = 'Demo Node Title' $('button')… >>> More

  • AJAX in Drupal Forms?

    as seen on Stack Overflow - Search for 'Stack Overflow'
    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… >>> More

  • Drupal module permissions

    as seen on Stack Overflow - Search for 'Stack Overflow'
    When I run the code with an admin user, the module returns what it should. However, when I run it with a normal user, I get a 403 error. The module returns data from an AJAX call. I've already tried adding a 'access callback' = 'user_access'); line to the exoticlang_chat_logger_menu() function. I'd… >>> More