Chapter 7: Form Handling

Return to Chapter 7

 

To use this script on your own page, click in the text area below, select all, and copy to grab the script. Then, just paste into your own page — and you're done.

Making Fields Required

See it run: Making Fields Required

Script 7.5

This HTML page contains form fields that are required to be filled out by the user before the form can be submitted.

Script 7.6

This CSS file sets the style for invalid form elements.

Script 7.7

This JavaScript does the form checking. It serves as the basis for all the rest of the examples in this chapter.