[removed] client-side vs. server-side validation

后端 未结 13 749
余生分开走
余生分开走 2020-11-21 11:58

Which is better to do client side or server side validation?

In our situation we are using

  • jQuery and MVC.
  • JSON data to pass between our Vi
13条回答
  •  感情败类
    2020-11-21 12:05

    I came across an interesting link that make a distinction between gross, systematic, random errors.

    Client-Side validation suits perfectly for preventing gross and random errors. Typically a max length for texture and input. Do not mimic the server-side validation rule; provide your own gross, rule of thumb validation rule (ex. 200 characters on client-side; n on server-side dictated by a strong business rule).

    Server-side validation suits perfectly for preventing systematic errors; it will enforce business rules.

    In a project I'm involved in, the validation is done on the server through ajax requests. On the client I display error messages accordingly.

    Further reading: gross, systematic, random errors:

    https://answers.yahoo.com/question/index?qid=20080918203131AAEt6GO

提交回复
热议问题