Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Thanked 0 Times in 0 Posts

    server side validation verses client side validation

    Hi I'm new to javascript and asp programming. Can someone please tell me when I would use client side validation instead of server side validation.

    Thanks for your help

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Halle (Saale), Germany
    Thanked 1,009 Times in 982 Posts
    If you are talking about a publicly accessible website then you would/should never use client-side validation instead of server-side validation. Rather, you always use server-side validation and add client-side validation to complement/enhance the functionality.

    Only if you have full control over the program the user is using and can assure that they are not able to deactivate JS by themselves you could solely rely on client-side validation.

  • Users who have thanked VIPStephan for this post:

    Knight2 (06-20-2013)

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,539 Times in 2,517 Posts
    JavaScript form validation only provides convenience for users, not security. This means that JavaScript should be used as an "enhancement", not as a requirement. So your form should not be dependent on JavaScript alone to perform your validation. Instead, whatever server-side language you use to process the form (PERL, ASP, PHP, etc.) should also perform the same validation. Otherwise, people will be able to bypass your validation (and even possibly inject malicious code) simply by disabling Javascript.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    Knight2 (06-20-2013)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts