Login

jason_gates's blog

Making Our Report Sortable and Paged - Drupal 7 Multi-Step Form (FAPI)

In this post we are going to replace the stub code detailed in the my previous (Drupal 7 Multi-Step Form (FAPI) with Table Report). We are going to store our data in a new database table. We'll update our report so that users can sort it and scroll through pages.

We'll add a new file listing for our database table install (and unistall cleanup). I'm using the name "proto" for our example module. In Drupal 7,  you don't need to explicitly install your modules schema. Here is our proto.install listing:

Drupal 7 Multi-Step Form (FAPI) with Table Report

In this post we are going to show how easy it is using Drupal 7's Form API (aka FAPI) to create a multi-step form with a simple html table report.

We'll also demonstrate the development technique of stubbing. In our case, we haven't decided how we want to store our data (for our final design). Therefore, we will use a simple Collection class and Drupal cache mechanism to perform a temporary yet simple stub.

The stub allows a developer to concentrate on one task (e.g. form/user interface), while another developer designs the full implementation (i.e. decides/codes a Drupal Field API instance, custom database tables, etc).

In our example we going to have users enter their name and a favorite color. The first step in our multi-step form is to ask the user to enter their name:

Syndicate content