I actually thought maybe this was a joke. This seems like a pretty brittle and hard to maintain way to go about this.
Surely a better solution is something more declarative which is then wrapped up in a library of some sort that does the heavy lifting.
An example of declarative validation is in ASP.Net MVC 3 and above where you can define validation on the server side models, enable unobstrusive javascript and you get both server and client side validation where the client side work is done by jquery and the server side by the model binding infrastructure that turns http request data into controller inputs.
Surely a better solution is something more declarative which is then wrapped up in a library of some sort that does the heavy lifting.
An example of declarative validation is in ASP.Net MVC 3 and above where you can define validation on the server side models, enable unobstrusive javascript and you get both server and client side validation where the client side work is done by jquery and the server side by the model binding infrastructure that turns http request data into controller inputs.