tags:

views:

191

answers:

4

hi, i really love the jquery validation plugins, look neat stylish and accessible, but as you know JavaScript can be turned off and boom your user can enter what ever he wants, therefore you should validate on server too, so what is the best approach here ?

do double validation one with jquery and one on server side or is there a better solid secure way ?

+7  A: 

The only way to go is to validate with jQuery and then do the same validation again on the server side.

Client side validation is only for making your application more user friendly. So validate the fields that will save the user some round-trips to the server and that will contribute to a better user experience.

Always validate on the server side. This protects you from attacks to your application. It also helps from feeding erroneous input to your code.

kgiannakakis
I agree with you. You can never have too much validation. +1
ichiban
Yep. Spot on. Just remember to keep the client-side and server-side validation routines maintained in parallel.
Cheekysoft
true man i think there is no other route, thanks cheekysoft what you mean in parallel?
+2  A: 

Well double validation is probably the only way to go - if the user disables javascript, then no validation will be executed on the client side, therefore you MUST have server side validation. On the other hand - for the convenience of most users - there should be a client side validation mechanism so that round-trips to the server are minimized.

Ramuns Usovs
+1  A: 

That's why I still use the Asp.Net validation. Because, with a minimal effort your data will be validated on the client and server.

GvS
+1  A: 

You should always validate your data server side, jQuery or not, never trust incoming data.

Fredrik Leijon