I'm really struggling to understand how to use Drupal 7's Form API in conjunction with its Ajax framework. I'd like to accomplish the following:

On certain pages, multiple nodes may appear. Each one of these nodes should have a comment form appear right below it. When the user submits a comment, it should be done via Ajax and the resulting comment should then appear under the node in question.

Can someone give me an overview of the steps that are required to do this?

2 Answers 2


There is a module for submitting forms with Ajax.

Provides AJAX comments to Drupal sites. Features:

  • Makes AJAX submits
  • Allows replies to comments on the actual thread page
  • AJAX comments deleting
  • Works with CAPTCHA
  • Cool jQuery sliding
  • They only have a dev version for D7.
    – maxedison
    Commented Feb 13, 2012 at 15:33
  • Indeed, but if you download the module and take a look a the code, you can get started on how to implement Ajax into your forms.
    – dimitril
    Commented Feb 13, 2012 at 15:42
  • Though it is in dev the ajax_comments module currently does what you are asking for. If you have any issues please file a ticket in the module's issue queue.
    – acouch
    Commented Feb 13, 2012 at 17:28
  • @maxedison Have a look at the issue queue, it doesn't look like there's anything particularly prohibitive in there, I'd just get stuck in and give it a try
    – Clive
    Commented Feb 13, 2012 at 17:46

Check out the Examples module. There is loads of information and examples on how to implement AJAX with Drupal 7 forms :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.