Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

why client side and server side validations?

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I dint understand in which case we do client side validation and in which case we go for server side validation...

what are merits and demerits in both sides of validations?

Thanks.
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ja,
Validation is required before submitting a form to the server(database-mostly) to check for authenticity of certain things.
Obviously when you say password cannot be empty, is it a point to send it the server? No. Then you must stop it before it reaches the server. This is client side validation.
Now consider, I am trying to compromise someone's account and i send some info in the password. I need to check inthe DB if the info is correct or not. As this info is in the DB i need to do a server side validation.

Why, most importantly, we are talking about it because the sever side trip is expensive in terms of network bandwidth consumption(here which would be invalid request anyway-empty password request), connections and host of other things that are involved with the server side connections( sockets opening, etc-internal).
So a server should be hit only when reqd.
Thus most applications have a client side and a server side valdiation. Its a good practice also.
[ November 09, 2006: Message edited by: RoshaniG Gopal ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With regard to validation, it's important to understand that whether or not to do server-side validation is never a question. One must always do server-side validation.

As Rosthani mentioned, client-side validation can save bandwidth by catching some errors before they are sent to the server. However, even if an error is checked with client-side validation, the same error must be re-checked on the server side. The reason for this is that client-side validation is not 100 percent reliable. A user can turn off JavaScript on the browser, thereby making all your client-side code inactive.
reply
    Bookmark Topic Watch Topic
  • New Topic