Form Processing

In this chapter we'll create an admin section for the blog. Adding, editing and deleting posts are regular tasks that need to be done.

Form processing is a routine task for web applications. It's a mostly boring and monotone duty that still needs to be done with high diligence. Validation must be performed, errors handled and forms pre-filled with values. Agavi offers multiple facilities to help form processing.

The result of this chapter can be downloaded at http://www.agavi.org/guide/stages/stage7.tgz

Form Processing Workflow

A form should be processed in these steps:


  1. Present the input form to the user - this is usually named "input" and should be a GET request
  2. Submit the form to the same action using a POST request
    1. If an error occurs, present the form again with prefilled fields and error messages.
  3. If validation and form processing are successful, redirect the user to a success page. This should be a GET request to a different URL.