SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2006
    Posts
    466
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Forcing Javascript Form Validation

    Hello,

    I just created multipage form that uses javascript form validation. On a beta test of my site, I noticed that the database was empty in fields that are required.

    So, out of curiosity, I turned off javascript on my browser. To my dismay, I was able to go right through the form ignoring all validation.

    I'm guessing every person on the planet running web security software has this sort of thing disable.

    So is there any way to force java form validation or should I switch switch to php?

    Surely with all the sites in the universe using java form validation, there is way to keep people from simply bypassing the validation entirely!

    Brandon Drury
    Home Recording Forum -
    Make 60% Commission Pushing my new mega system
    Killer Home Recording

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,191
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    javascript

    It is nothing for someone to save a local version of the form and use, or not, their own javascript. Never rely on javascript to provide any critical steps when handling user supplied input.

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2006
    Posts
    466
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why on earth would anyone (other than sub-fecies level scum) EVER recommend using javascript form validation? If a person wants validation because it is pretty......

    I realize that rainbows, bunnies, springtime dresses, and javascript alert messages may look pretty but I can't possibly fathom how I've been let down by the system to this degree.

    Well, I'm glad I only wasted 100 hours on javascript validation. It would have sucked if I had put any significant amount of time into learning a system that is a complete waste of time for anything other than the creation cotton candy-esque effects.

    I suggest we begin a new "Final Solution" to rid the world of the wretched waste known was "javascript" and anyone who endorses it. Speaking of which. If javascript can not adequately validate form data, what can it do? Is there a single purposes (beyond cutesy stuff and the temporary ruining of my life) that javascript can do?

    Brandon
    Home Recording Forum -
    Make 60% Commission Pushing my new mega system
    Killer Home Recording

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Validation should always take place server-side. Nefarious users may not even submit via your form; they could use a script that sends an HTTP request directly to your server.

    Then you can add client-side validation via JavaScript as an add-on (progressive enhancement). It will give faster response to the majority of users who have JavaScript enabled, and it will reduce the load on your server by avoiding unnecessary round trips to it.

    But you should always build the page with server-side validation first, and add client-side validation afterwards.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

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