Client side validation - good, bad, or useless?

How do you guys feel about client side validation? Do you think its
necessary or a waste of time?

jko170 wrote:

How do you guys feel about client side validation? Do you think its
necessary or a waste of time?

Good: gives user immediate feedback without the overhead of a server
request.

Waste of time: Only works if JS is on. Not airtight, and may cause
problems for browsers that don’t do JS.

With those facts in mind, determine what makes sense for your app. I
rarely use client-side validation, but I could imagine places where it’s
helpful.

The one you can’t forget is DB-level validation. The app is not
sufficient to keep bad data out of the DB.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

How do you guys feel about client side validation? Do you think its
necessary or a waste of time?

All depends on the app for me. You obviously have to validate server
side regardless, but if there are things you can do client side to
make it easier for the user, go for it. I’m thinking things like
“username can only be lowercase alphanumeric”… if you can stop
someone from filling out an entire form only to complain they ignored
your rule… that’s a nice feature.

There’s a plugin out there that will take your AR model validations
and convert them into javascript validations in your form. Can’t
recall the name, but that might simplify things for you.

Now… my personal pet peeve is forms that demand that phone numbers
be in a certain format… I happen to like 555.555.5555 and that
happens to be what my browser remembers. Drives me nuts when it
whines that I have to use 555-555-5555. Just strip the non numbers
and format it yourself! grumble grumble

The same is true for credit card numbers… point being if you can
clean it up server side and still know what you’ve got, do it :slight_smile:

-philip

Philip H. wrote:

How do you guys feel about client side validation? Do you think its
necessary or a waste of time?

All depends on the app for me. You obviously have to validate server
side regardless, but if there are things you can do client side to
make it easier for the user, go for it. I’m thinking things like
“username can only be lowercase alphanumeric”… if you can stop
someone from filling out an entire form only to complain they ignored
your rule… that’s a nice feature.

Yes. And you don’t need client-side validation for that, just a note.
Sounds obvious, but you’d be amazed how often I see it omitted.

There’s a plugin out there that will take your AR model validations
and convert them into javascript validations in your form. Can’t
recall the name, but that might simplify things for you.

I’ll check that out. That was actually something I liked about
ColdFusion.

Now… my personal pet peeve is forms that demand that phone numbers
be in a certain format… I happen to like 555.555.5555 and that
happens to be what my browser remembers. Drives me nuts when it
whines that I have to use 555-555-5555. Just strip the non numbers
and format it yourself! grumble grumble

The same is true for credit card numbers… point being if you can
clean it up server side and still know what you’ve got, do it :slight_smile:

Agreed 100%. Don’t make the user do things that the app should be smart
enough to do itself.

-philip

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

The plugin is this: http://livevalidation.rubyforge.org/

On Oct 9, 2:53 pm, Marnen Laibow-Koser <rails-mailing-l…@andreas-

I do both. Server-side is an obvious must. Client-side minimizes
unnecessary hits on your server, and it has a better “feel” to the
user. For example, if they neglect to fill in certain required fields,
no reason to go all the way to your server and back to figure that
out.

The problem I have found is its adding unnecessary work. If the server
side has the validations, why do you need client side? Hitting the
server is a non-issue as I believe most people fill out forms
correctly on the first go.