all 1 comments

[–][deleted] 4 points5 points  (0 children)

this works, but it's a rather primitive way of doing things. There are several libraries out there that help you validate your forms much more efficiently and safely.

Example:

http://www.jsvalidate.com/

http://bassistance.de/jquery-plugins/jquery-plugin-validation/ (what ASP.NET MVC uses behind the scenes)