Let's Go › Processing forms
Previous · Contents · Next
Chapter 8.

Processing forms

In this section of the book we’re going to focus on allowing users of our web application to create new snippets via a HTML form which looks a bit like this:

08.00-01.png

The high-level workflow for processing this form will follow a standard Post-Redirect-Get pattern and look like this:

  1. The user is shown the blank form when they make a GET request to /snippet/create.
  2. The user completes the form and it’s submitted to the server via a POST request to /snippet/create.
  3. The form data will be validated by our snippetCreatePost handler. If there are any validation failures the form will be re-displayed with the appropriate form fields highlighted. If it passes our validation checks, the data for the new snippet will be added to the database and then we’ll redirect the user to "/snippet/view/:id".

As part of this you’ll learn: