Stustu
Stustu

Reputation: 158

Rules: Client-Side validation vs. Server-Side validation?

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

Upvotes: 1

Views: 508

Answers (4)

SmartDev
SmartDev

Reputation: 119

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 .

Upvotes: 0

ACP
ACP

Reputation: 35268

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

Upvotes: 1

Faruz
Faruz

Reputation: 9959

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

Upvotes: 4

D.C.
D.C.

Reputation: 15588

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.

Upvotes: 1

Related Questions