Is JavaScript validation bad?

后端 未结 14 1644
栀梦
栀梦 2021-02-01 11:56

It has been long time since we have been validating our forms using JavaScript. I am sure this must be the case with most other developers.

Question:

What if the

14条回答
  •  情歌与酒
    2021-02-01 12:25

    What if the user (or probably a bad guy) disables javascript?

    As said before: Simply do not rely on the client. Never do so. Check everything on the server again.

    Should we ever use it now?

    Yes - so the user immediately sees what's wrong. Otherwise he had to post back the data first which may take a while. By the way you reduce traffic to your server.

    It's simply more inuitive.

    //EDIT: BTW: The ASP.NET ValidationRules contain both client-side and server validation as far as I know.

提交回复
热议问题