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

前端 未结 10 1087
广开言路
广开言路 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 09:37

    Always validate every input server-side. You don't know that their client supports javascript "properly", or that they aren't spoofing their http requests and bypassing your javascript entirely.

    I'd suggest not limiting your checks to one location though - additional checks within the javascript make things more responsive for your users.

提交回复
热议问题