I dont know what language and platform you use, but ASP.NET has a nice solution for that. They call this "data annotation validations". You simply put the rules in a ViewModel, and they will be checked both client side and server side. This way, you could simplify the jquery.validate (client side), and in your controller, check them with Model.IsValid (server side)
Indeed, but this is more like a backup for when the client has disabled JS.
What if you want to use Angular + .net API? Anyway you need to duplicate validations. :)
It's really hard to do a 100% business app, beyond CRUD using plain ASPNET MVC.
I second that. Data annotation validations work well for a CRUD type of feature, less so for relational constraints.
I'm working on this domain where computers are leased to customers. In order to record a dispatch, many fields have to be filled in. But there's rules about field values that limit the valid options for other fields. I implemented just the basic ones.
The real challenge would be formalize the rules in such a way you can get the most efficient decision tree in the UI as well being able to validate command input :)
Thanks for the advice, it's ASP.Net MVC indeed :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.