Javascript in Drupal 4.7

Last modified: March 7, 2008 - 19:05

Javascript was introduced to Drupal in the 4.7 release. If you are developing for a later release, see the documentation for Drupal 5+.

Drupal's Javascript tools

Drupal's 4.7 javascript toolkit has three basic components:

  1. drupal.js
    The javascript file drupal.js contains methods for implementing Javascript solutions, including AJAX (see below).
  2. PHP functions
    Specific Drupal functions in PHP help Javascript developers. These include drupal_add_js(), used for adding a js file to a page; drupal_call_js(), used to generate a javascript call; and drupal_to_js(), used to translate data from Drupal PHP to Javascript objects.
  3. Prebuilt tools
    As well as the generic tools in drupal.js and the PHP Javascript functions, Drupal core ships with three prebuilt tools: collapse, used to collapse and expand form fieldsets; progress, used to indicate progress of an action; and autocomplete, used to simulate drop-down select options when users enter text into a textbox.
 
 

Drupal is a registered trademark of Dries Buytaert.