Last updated March 7, 2008. Created by redndahead on December 27, 2005.
Edited by AjK, nedjo, puregin, sepeck. Log in to edit this page.
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:
- drupal.js
The javascript file drupal.js contains methods for implementing Javascript solutions, including AJAX (see below). - PHP functions
Specific Drupal functions in PHP help Javascript developers. These includedrupal_add_js(), used for adding a js file to a page;drupal_call_js(), used to generate a javascript call; anddrupal_to_js(), used to translate data from Drupal PHP to Javascript objects. - 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.