Chapter 10. Getting Input with Forms

IN THIS CHAPTER

  • Adding forms

  • Getting short data with text boxes

  • Gathering information with text areas

  • Making choices with check boxes and options buttons

  • Saving space with the SELECT and OPTION elements

  • Using INPUT buttons

  • Using the BUTTON element

  • Adding hidden fields

  • Adding labels

  • Setting tab order

  • Specifying access keys

  • Submitting the form

  • Simple DOM

Forms provide a way for your site's visitors to give you information. Using a variety of different input techniques, forms enable you to gather all sorts of data, ranging from simple "yes" or "no" answers to complex written responses.

Forms are used for several different purposes. Most often, they are used to gather contact and delivery information for situations ranging from e-mail newsletters to the shipment of physical products. As HTML's native method for acquiring user input, forms are a powerful part of your Web design repertoire, enabling limitless opportunities for gathering information.

When it comes to visual presentation, however, forms leave a little bit to be desired. In fact, if you stick with the plain method of adding form controls and their accompanying text to your pages, you end up with a pretty sorry-looking design. To avoid this, embed your forms within tables, as the majority of Web designers do to keep their forms neat and attractive. This chapter is dedicated only to the use of forms. The technique for meshing them with tables is covered in detail in Chapter 6.

Adding Forms

As shown in

Get Creating Web Sites Bible, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.