tags:

views:

66

answers:

4

Are there are any rules for when to use Client-Side validation and when to use Server-Side?

+1  A: 

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.

darren
+4  A: 

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.)

Faruz
was about to type d same.
echo
Good thing I practiced my quick-typing then... :)
Faruz
+1  A: 

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....

Pandiya Chendur
A: 

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 .

SmartDev