I wanted to do the same thing, it can be done, but it is difficult. You can create reliable server-side validation methods that you call remotely using Ajax. If javascript is not enabled, you simply use the usual server-side validation methods without remote calls. Thus, you will have only one code base for verification.
However, the problem is that your client check will be much slower because it must constantly interact with the inner end. An even bigger problem is that you cannot use some powerful client validation libraries, since all of them assume that the verification is performed on the client and not remotely.
I just refused it. I had to duplicate my validation logic and error message on client and server. This is not ideal, but is best for users, and you can use large front-end libraries.
Ferdy source share