Reputation: 25161
Looking at five or six login sections for various major 'web 2.0' sites, many of them seem to do all the validation server-side.
Can anyone provide any reasons for why none of these use client side validation aswell (i.e. javascript)? A prime example would be checking for empty text boxes when the user clicks 'login' and popping up an alert('Please enter your password and try again')
).
I'm aware it is easily circumvented/disabled, so for security reasons is pointless.
Upvotes: 1
Views: 235
Reputation: 1037
'cause it's pain in the *ss to write JS validation code ? :D just leaving the room
Upvotes: 0
Reputation: 212452
Personally, I always try to use both, but I can think of two reasons not to use Client-side validation.
Upvotes: 1
Reputation: 181990
There's no good reason not to use that kind of check. Saving your users time and frustration is a Good ThingTM.
Better yet, instead of a popup, disable the Login button (from JavaScript, not in the HTML itself, to make it degrade gracefully). Enable it only if a username and password are filled in, and display a helpful message that explains why the button is disabled. This could be as simple as the grey text "Enter your password" in the Password box.
Upvotes: 2