Multistep Forms with Lookup Functions that Change Values

A number of people lately have been asking about how to change the values of form fields in multistep forms. So I wrote up an example.

Here we have a simple multistep form that lets you enter the name of a U.S. state, such as Iowa. Note the form has a default value.

Then, upon clicking the Lookup button, the value "Iowa" is replaced with a standardized state abbreviation, IA.

Upon submission both values are available to the submit function.

This example is not intended to do anything useful. It's just a little example that you can poke around with to learn how the sometimes confusing multistep form submission works in Drupal 5. You can download the module here.