With all of the form processing going on on the internet today, there's a few different ways to go about validating the input that a user gives you (cardinal rule: always filter/validate input), whether it be server or client side. In this new article from DevArticles, they talk about the latter of the two - Form Validation with Javascript.
Forms are one of the most useful ways to collect information online from customers and potential customers who visit your website. But that information is just a waste of electrons if it is not correct. How can you validate it? This article explains some of the building blocks you can use in JavaScript to at least ascertain that information entered into a form is in the expected format.
In this article (Part 1), they explain what regular expressions are good for, how they are used in Javascript, and some simple examples (matching "www", checking for other characters, and working with escape codes).
A lot of the power of Javascript (no, that's not an oxymoron) is lost when it's not considered for form validation - the load on a PHP script could be lessened that much more from a good regex on the browser's side of things...




