If you remember the following, it might seem that you can duplicate some of the checks.
Allow verification in two parts. A) Business confirmation, for example. "The amount in field X must be greater than $ 500 if flag" Y "is marked" B). Basic data checks, for example. data type checks, null checks, etc. (We can discuss that each audit is a business audit, but this is purely contextual).
Category A: This is part of your business logic and should only be stored on the server side.
Category B: Validations of this type are potential candidates to be placed on the client side. But keep in mind that browser validation can be bypassed . This does not mean that you should not have validation on the browser side at all, but such checks should only be considered as a bonus to save the network transition from the server. The server must re-run these checks.
In a nutshell, validation should not be considered as a unit of reusable code at different levels. Their purpose varies and should provide redundancy.
Hope this helps.
source share