O'Reilly logo

Sams Teach Yourself CGI in 24 Hours, Second Edition by Rafe Colburn

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

Using JavaScript for Form Validation

Although this book is about CGI programming, I want to talk a bit about JavaScript—the first line of defense for validating user input. The most important thing to remember about using JavaScript to validate forms is that it’s not completely reliable. In other words, you must validate the form content on the server side as well.

There are two advantages to using JavaScript to validate forms. One works to the benefit of the user, and the other works to the benefit of the systems administrator. Users benefit because JavaScript provides instant feedback. You can set up your form validation so that it tests the value in a form field the moment the user leaves that field, or before the form is submitted. Either ...

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