How do you guys feel about client side validation? Do you think its necessary or a waste of time?
Marnen Laibow-Koser
2009-Oct-09 21:37 UTC
Re: Client side validation - good, bad, or useless?
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 marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Philip Hallstrom
2009-Oct-09 21:39 UTC
Re: 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?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 :) -philip
Marnen Laibow-Koser
2009-Oct-09 21:53 UTC
Re: Client side validation - good, bad, or useless?
Philip Hallstrom 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 :) >Agreed 100%. Don''t make the user do things that the app should be smart enough to do itself.> -philipBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
The plugin is this: http://livevalidation.rubyforge.org/ On Oct 9, 2:53 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- s.net> wrote:> Philip Hallstrom 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 :) > > Agreed 100%. Don''t make the user do things that the app should be smart > enough to do itself. > > > -philip > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/.
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. On Oct 9, 2:55 pm, jko170 <jko...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The plugin is this:http://livevalidation.rubyforge.org/ > > On Oct 9, 2:53 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- > > s.net> wrote: > > Philip Hallstrom 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 :) > > > Agreed 100%. Don''t make the user do things that the app should be smart > > enough to do itself. > > > > -philip > > > Best, > > -- > > Marnen Laibow-Koserhttp://www.marnen.org > > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > > Posted viahttp://www.ruby-forum.com/.
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. On Oct 9, 5:59 pm, wbr <banane...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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. > > On Oct 9, 2:55 pm, jko170 <jko...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > The plugin is this:http://livevalidation.rubyforge.org/ > > > On Oct 9, 2:53 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- > > > s.net> wrote: > > > Philip Hallstrom 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 :) > > > > Agreed 100%. Don''t make the user do things that the app should be smart > > > enough to do itself. > > > > > -philip > > > > Best, > > > -- > > > Marnen Laibow-Koserhttp://www.marnen.org > > > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > > -- > > > Posted viahttp://www.ruby-forum.com/.