开发者

Rules: Client-Side validation vs. Server-Side validation?

开发者 https://www.devze.com 2022-12-25 01:57 出处:网络
Are there are any 开发者_运维问答rules for when to use Client-Side validation and when to use Server-Side?The right answer is probably use both.

Are there are any 开发者_运维问答rules for when to use Client-Side validation and when to use Server-Side?


The right answer is probably use both.

Client-Side validation is faster and should be used as much as you can before submitting the form to the server.

BUT! You can't count on client-side validation since there are easy ways to go around it, so you need to repeat all the validations on the server-side and add new validations if you need (for instance: using database to add more validations etc.)


It is ok to use client-side validation for convenience. You should always validate critical info on the server though, since client's can be circumvented.


What happens if javascript is disabled in client's browser?

So go for Server side validation.... I think there is no rules for validating on client/server... Its upto you and your users....


its better to validate both sides for better peroformance and it would be secured , as it avoids duplicate entry , we would know that, data entered is correct at any point of time . Client side is always good and its mainly for User interface for the user to know the what is right or wrong .

One more thing if we are writing our own stored procedures than its better to write validations on proc side so tht message can be passed through output parameter also .

0

精彩评论

暂无评论...
验证码 换一张
取 消