Where do you record validation rules for form data in a web application?

前端 未结 10 1107
广开言路
广开言路 2020-12-24 09:34

Say you have a web form with some fields that you want to validate to be only some subset of alphanumeric, a minimum or maximum length etc.

You can validate in the c

10条回答
  •  一个人的身影
    2020-12-24 10:04

    1. Client-side validation for good, responsive user interfaces
    2. Server-side validation because client-side code can be bypassed or modified and so can't be trusted
    3. Database validation if you have multiple apps feeding into one db. It's important here as then a change to validation is automatically propagated to all apps and you don't lose data consistency.

提交回复
热议问题