form validation with javascript vs php

Viewed 36675

Why should I bother to use JavaScript for form validation when I still have to use PHP since the user could have JavaScript support turned off.

Isn't it unnecessary?

Update:

Ok thanks for your answers. it sounds like a good idea to have it on the client side too. where can I download good JavaScript validations?

Do you know where I can download a validation script like that one in yahoo when you register an account?

8 Answers

I recommend you using unified server-side and client-side validation using a framework, since it may avoid confronting the user to data valid on client side but rejected by the server, or the opposite (client side too restrictive). Following list of framework give information about server/client side validation: http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks

Yes, it is best practice to validate the user input values from both sides client and server side ,

some cases client was disabled javascript or mobile browser that doesn't javascript, remember there is spammers also.

Related