Web Hosting Talk







View Full Version : pro and cons of data validation at client side and at server side.


dnguyen
04-10-2005, 12:05 AM
Any one tell me more about the pro and cons of data validation at client side, and at server side ?

For example:

Pro of client side data validation, save CPU/Memory server resource.

Cons: If some one by pass the client side data validation, the server get wrong data.

(Please do not tell me why not validate data at both ends :)

Tweakbird
04-13-2005, 05:53 PM
One con of client side is if they have java script turned off, it will not work as expected, but that is only if your using java script to do your validation.

BigBison
04-13-2005, 09:26 PM
Originally posted by dnguyen
(Please do not tell me why not validate data at both ends :)

I'm not sure why you're ruling this out. As tweakbird pointed out, no client side method will catch everything, so you still need to validate on the server side.

Just because you are validating on the server side, is no reason not to save some server load by implementing client-side validation.

johndp
05-23-2005, 11:45 PM
Yeah, I'm sure you know this -- make sure you don't put any validation of "sensitive info" on the client side -- like passwords, etc.

But as a user, I'd prefer browser to validate the form too before server processes it, as very often servers spit a page out with half the fields erased -- hate it!