Drupal Association members fund grants that make connections all over the world.
This tutorial, for beginning and intermediate Drupal programmers, includes basic and some advanced features of the Form API (example: multistep forms). Intermediate programmers may want to skip down to code sample #8. The tutorial includes the ability to copy and paste the following code snippets into a module for viewing and experimenting.
First, learn how to get the code snippets working. For an existing Drupal 6 site:
- Create a new directory in sites/all/modules and name it 'my_module'
- Create a file named my_module.info in the my_module directory with the following contents:
- Create a file and name it 'my_module.module'. Cut and paste the first code sample into the my_module.module file (note that it's preferable to omit the closing
- Enable the "My module" module on the administer/site building/modules page.
- Type the following in the browser address bar: http://yoursite_site_url/?q=my_module/form or http://yoursite_site_url/my_module/form depending on your configuration.
- For each code sample in the tutorial, completely replace the code in my_module.module with the new code snippet and type the following in the browser address bar: http://yoursite_site_url/?q=my_module/form or http://yoursite_site_url/my_module/form depending on your configuration.
name = My module description = Module for form api tutorial core = 6.x