开发者

Form Validation With Js/Jquery & PHP

I'm building up a site that utilizes a lot of forms and 开发者_运维知识库before I decide on what 'standard' I want to use for most of my form validation, I would like to know what makes the most sense:

  1. Should I validate forms on the front end with js/jquery?

  2. Should I validate forms on the back end (server side) with Php?

  3. Or should I validate on both sides?

I think validating on both sides makes the most sense in terms of security, but my worry is that the site might not be scalable if I try to process too much validation (e.g. is there such thing as too much redundancy with validation especially if I have pretty complex forms with 20-50 fields?)

Thanks


You should validate on both front end and back end. Front end validation will not affect your sites scalability badly because the processing is done in the client's browser. In fact front end (client side) validation will help in scaling as it saves precious bandwidth and server side processing.

You should never ever leave out server side validation, as client side validation can be tampered by a malicious user.

So you should use both.


I would validate on both ends, javascript/jquery will look nice for the user, but can be turned off, you don't want the user able to turn off all validation, so check it on the back end as well.


I say both sides. Client side so the user doesn't have to refresh/submit the page before knowing something is wrong. But client-side is easy to edit/remove from the page entirely. You should never rely on it and always do server-side validation.


yes i would also recomend both sides to avoid something you don't want

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜