Here is a neat javascript way to validate forms on the client side by assigning CSS classes to form elements.