O'Reilly logo

Essential JavaScript™ for Web Professionals, Second Edition by Dan Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Project II: Error Handling of Forms

Chances are that most people will fill out the form correctly. However, some will mistype their responses, some will skip information the marketing folk desperately need, and some will fill in the boxes with garbage just to enter the contest.

If you include some JavaScript to error-check the form before it's submitted to the CGI script, the marketing people will have less incomplete or nonsensical data to sort through. Error checking will also make the CGI programmer's life easier, because you can guarantee that the data will arrive in certain forms. This is a pretty lengthy script, so we will break it up into a couple of sections: First we will check for empty form fields and erroneous data entered by the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required