Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JS Validation obsolete in the face of Server-Side methods?

    I've been digging into my less than ample JS skills over recent weeks, including working on simple ways to do form validation like making sure fields are filled in. I got to thinking though: JS requires support, and while it is widely supported, it is not universal. Validating using server-side processing is universally supported since the client deals only with HTML, not like I need to tell y'all.

    So I guess my question is, does it seem somewhat pointless to do any JS validation when server-side options are present? The one obvious reason client-side is better is because it doesn't require a trip to the server, but again, the support for server-side methods would be universal. Validation would be pointless if a non-scriptable user would just fly right past it and get cryptic errors that should never have happened because the JS was supposed to catch it.

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Even if you do implement Javascript validation, you still must implement it server-side as welll. The user can always modify your Javascript dynamically through javascript: and bypass your validation, injecting malicious data. It's just basic security to check things server side.

    However, saving the trip to the server for normal users, that's a big usability increase, no? Building a website is never about your own convenience, it's about the clients' convenience. Which is why Javascript-validation still has a major role to fill.

  • #3
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, but it seems excessively redundant to me. It's not about my convenience, it's about my better common sense. A trip to the server for server-side validation is not the end of the world. Saving it is nice, but considering that the JavaScript in this instance only adds benefits for "normal" users, I question its necessity at all. If a page says "these fields are required," and you do not fill them in, you don't have much right to get pissed off when you go ALLLLLL THE WAYYYY to the server only to find out you missed something and have to go back.

    I mean, does that sound terribly unreasonable? After all, page weight affects usability, and as a matter of principle, I feel that cutting unecessary fat is highly commendable. And on top of it all, it might encourage somebody to read the damn directions for once too.
    Last edited by ]|V|[agnus; 06-28-2004 at 06:59 PM.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Client and server side form data processing serve two different purposes and therefore complement each-other.
    Server side form data validation assures the security and completeness of data from the application point of view.
    Client side form data verification serves only as user convinience/aid tool.
    While server side validation should always be present, client side verification improves usability and adds user friendliness.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #5
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Right! And I don't disagree with that... what I'm questioning, I suppose, is whether or not client-side is worth it. Considering that it means more page weight, requires conditions which are not omnipresent, and means more development time, it almost seems most sensible to forego client-side unless it is specifically requested as part of the spec. Furthermore, I think the idealistic benefits of encouraging people to read directions, etc. are not without there little bit of merit as well. It's not our role as developers to teach something like that, but I think it's not out of place in our role as fellow human beings to be concerned about something like that. It's almost like a People Standard, not unlike Web Standards. If there were a better established groundwork for things like reading directions, things like validation might seem completely absurd! (Of course they wouldn't, "better safe than sorry" will always ring true, but I think you get what I'm trying to say. Maaayyybe... )

  • #6
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Client-side validation does not actually add that much to the script in weight or development time unless your talking big validation (like phpMyAdmin). All it is as a function with a few regexps which then submit a form, no biggy

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hmm... let's see... there is one VCR that requires you to read the 100 page manual so you know how to operate it and there is another VCR that propmts you about your mistakes, guides you during operation and makes things more intuitive.... which one would you buy???
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #8
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Vladdy
    hmm... let's see... there is one VCR that requires you to read the 100 page manual so you know how to operate it and there is another VCR that propmts you about your mistakes, guides you during operation and makes things more intuitive.... which one would you buy???
    I'd buy the latter Although ss isn't exactly a 100 page manual!

  • #9
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Vladdy
    hmm... let's see... there is one VCR that requires you to read the 100 page manual so you know how to operate it and there is another VCR that propmts you about your mistakes, guides you during operation and makes things more intuitive.... which one would you buy???
    The one with the 5 page quick start guide. Manuals not typically needed for basic operation. A few simple instructions, as is common and expectable on a form, are more like the quick start guide that comes with many products these days.

    I understand your point though, and I love the idea of client-side, but I am just trying to explore some thoughts that I don't think are wholly dismissable.

    As for the comment about page weight, I know it's not THAT much, but it's some, and that's the whole point. Does a wheat farmer aim to get rid of as much chaffe as possible, or just some or whatever he feels like that day?

    Obviously it's about weighing many factors, but meh...


  •  

    Posting Permissions

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