O'Reilly logo

Drupal 6 Theming Cookbook by Karthik Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding the form ID of a form

Drupal's Form API uses an ID field to identify each form. These IDs are usually automatically generated based on the function declaring the form and are therefore unique. Consequently, they can be used to identify specific forms either while altering the form using hook_form_alter() or for theming purposes using JavaScript and CSS.

In this recipe, we will look at ways to identify the Form ID of a form.

Getting ready

We will be using the Devel module to retrieve and display the form ID, and the Search module to simulate a situation where there is more than one form on a page. Additionally, we will be adding our code to the mysite module created earlier in this book. It is assumed that all these modules have been installed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required