I'm writing some input controls which some have a requirement for a custom validator.
I've just written one that validates 2 numbers. As this was relatively simple I wrote the client javascript and a server side method separately.
However, I got to thinking, would a better design be to use a web method/service for the client and have one central repository for the validation. Does making an async call to the server outweigh the maintainability?
I have more complex validation coming up and I don't think I have the javascript skills to carry it out completely, but that aside I'd appreciate some opinions on what is the best solution here.
I guess there's a sweet spot to reach here. Definitely your server validation should be your primary focus and it should be as failsafe as possible.
I wouldn't make too many calls to the server, that's why I call it 'client validation' - because it happens exclusively on the client with only data that's available at that point in the browser. This should generally be simple things (formatting mainly, empty fields, etc) because it's only for usability anyway. Of course there might be the odd scenario where a server call would greatly enhance the usability but those can always be added at a later point.