...

View Full Version : JS Validation obsolete in the face of Server-Side methods?



]|V|[agnus
06-28-2004, 06:29 PM
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.

jkd
06-28-2004, 06:41 PM
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.

]|V|[agnus
06-28-2004, 06:47 PM
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.

Vladdy
06-28-2004, 07:19 PM
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.

]|V|[agnus
06-28-2004, 08:00 PM
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... ;) )

trib4lmaniac
06-28-2004, 08:40 PM
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 :thumbsup:

Vladdy
06-28-2004, 08:42 PM
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???

trib4lmaniac
06-28-2004, 08:53 PM
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 :thumbsup: Although ss isn't exactly a 100 page manual!

]|V|[agnus
06-28-2004, 08:55 PM
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...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum