This is an extremely trivial bit of JavaScript, but it is made difficult because it is trying to use a JavaScript framework developed by people who hate JavaScript. Do the form validation on the client side to give users instant feedback and then do final validation on the server side where you enforce business rules. These are two different kinds of validation and it's not actually effort saving to try to combine them. If you have good client side validation, you can just be a hard ass on the server side because you know that anyone who gets the server side error is already bypassing client side validation, so they are being naughty to begin with. It makes like easier to keep the validation separate.