Ah, good try at client side validation.

Check out http://thedersen.com/projects/backbone-validation/ for when you work with backbone.js.