CHAPTER 9 FORMS

IN THIS CHAPTER

How forms work

The form element

POST versus GET

Variables and values

Form controls, including text entry fields, buttons, menus, and hidden data

Form accessibility features

A word about form layout

It’s hard to go on the Web without encountering some sort of form, whether you’re making a purchase, signing up for a mailing list, or requesting product information. Although forms have a wide range of uses, from simple search boxes to complex online shopping interfaces, they are all built out of the same components.

This chapter introduces web forms, how they work, and the markup used to create them.

How Forms Work

There are two parts to a working form. The first part is the form that you see on the page itself. Forms are made up of buttons, text fields, and pull-down menus (collectively known as form controls) used to collect information from the user.  Forms may also contain text and other elements.

The other component of a web form is an application or script on the server that processes the information collected by the form and returns an appropriate response. It’s what makes the form work. In other words, putting up an (X)HTML page with form elements isn’t enough. Web applications and scripts require progamming know-how that is beyond the scope of this book, however, the Getting Your Forms to Work sidebar later in this chapter provides some options for getting the scripts you need.

From data entry to response

If you are going to be creating web ...

Get Learning Web Design, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.