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 ...
Get Essential JavaScript™ for Web Professionals, Second 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.