JavaScript in Drupal 6 - DrupalCon 2008

March 5, 2008 I'll be giving a presentation on two of the most exciting new JavaScript features in Drupal 6. You might be able to guess, on Drag and Drop and the new AHAH framework in Drupal 6. These are two features that slipped in at the last possible moment in the Drupal 6 development cycle, but I feel will be a serious player in module development in Drupal 6 contributed modules.

Drag and Drop

Drag and drop is already implemented in many places in core: the blocks page, book outlines, menu hierarchies, taxonomy terms, file uploads, and others. In the contributed modules, CCK has already implemented drag and drop for field organization and it's likely we'll see it in the final version of Views 2. I posted a screencast of the drag and drop for the blocks page a few months ago.

AHAH Framework

AHAH stands for Asynchronous HTML and HTTP. It's a close cousin of AJAX, which is the same concept of making a HTTP request in the background through javascript, then updating the page somehow with the new content from the second request. The difference between them is AHAH simply returns HTML back, then directly injects it into the page. It's a simpler and more direct method of page manipulation.

Prior to Drupal 6, all modules wanting to implement an AJAX-like system were forced to write their own custom JavaScript files. Even with jQuery as part of Drupal 5, implementing JavaScript AJAX requests was still a daunting task for many PHP developers. With the new AHAH Framework in Drupal 6, PHP developers can leverage the power of jQuery and AHAH without writing a single line of JavaScript. By providing a handy FormsAPI property (#ahah), developers can create forms with dynamic options without re-inventing the wheel every time. The most common examples of this are the new "More" button in CCK for adding more fields and upload module now uses the AHAH framework rather than custom code for uploading files.

Presentation Outline

If you think you might be interested in learning about these new features in Drupal 6 (and where we're headed in Drupal 7) come by my session at DrupalCon Boston 2008!

I don't want to disappoint any attendees, so here's the rundown of what we'll be covering: