Chapter 11. Forms

IN THIS CHAPTER

  • Understanding forms

  • Inserting a form

  • Field labels

  • Text input boxes

  • Password input boxes

  • Radio buttons

  • Check boxes

  • List boxes

  • Large text input

  • Hidden fields

  • Buttons

  • Images

  • File fields

  • Submit and reset buttons

  • Tab order and keyboard shortcuts

  • Preventing changes

  • Fieldsets and legends

  • Using events with forms

  • Form scripts and script services

HTML's somewhat humble beginnings were send only; that is, the user could receive data sent from a Web server, but the server could not receive data sent from the user. This was quickly identified as a deficiency of HTML. Because most user agents were being run in graphical environments that included rich user interfaces, creating a similar interface to allow users to submit data back to a server seemed a natural extension.

Today, HTML forms present a complex yet flexible framework to allow users basic controls over data. These controls can be used to provide input back to scripts or to submit data. This chapter delves into the particulars of HTML forms.

Understanding Forms

HTML forms simply place a handful of GUI controls on the user agent to allow the user to enter data. The controls can allow text input and selection of predefined choices from a list, radio or check boxes, or other standard GUI controls.

After the data is entered into the fields, a special control is used to pass the entered data on to a program that can do something useful with it. Such programs are typically referred to as form handlers because they "handle" the form ...

Get HTML, XHTML, and CSS Bible, Fourth 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.