I have written a form using the form API, and I want the user to preview the form before submission. How can this be accomplished?

  • The Node module provides an example on how to do it, but in general it's not that easy. – Daniel Wehner Dec 20 '11 at 7:26
  • 1
    Can you elaborate a little bit more about your use case? What kind of data is the user entering? Do you have authenticated or anonymous users? – BetaRide Dec 20 '11 at 7:48

Effectively this is a multistep form. Display the form showing a "Preview" button. On submit save something to the session or $form_state and redisplay the form. If the value has been set in the session show a "Submit" button. On this submit you can save the form values to the database and clear whatever flag value you had in the database.

Not the answer you're looking for? Browse other questions tagged or ask your own question.