Hi, In PHP I was validating twice: client side and then server side. Certainly the code was not DRY but it made the user experience quicker and saved server requests. I thought of the client side validation as optimization of the application. In "Agile Web Development with Rails" there is no mention that I can find of purely client side form validation. Is this just not the Rails way? If people are still doing validation twice like I used to do then I''m curious how they are handling it. Does it conflict with AJAX in any way? Thanks, Peter _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Just thought I''d try again. Peter On 11/9/05, Peter Michaux <petermichaux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > In PHP I was validating twice: client side and then server side. Certainly > the code was not DRY but it made the user experience quicker and saved > server requests. I thought of the client side validation as optimization of > the application. In "Agile Web Development with Rails" there is no mention > that I can find of purely client side form validation. Is this just not the > Rails way? > > If people are still doing validation twice like I used to do then I''m > curious how they are handling it. Does it conflict with AJAX in any way? > > Thanks, > Peter >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Thursday 10 Nov 2005 05:57, Peter Michaux wrote:> In PHP I was validating twice: client side and then server side. Certainly > the code was not DRY but it made the user experience quicker and saved > server requests. I thought of the client side validation as optimization of > the application. In "Agile Web Development with Rails" there is no mention > that I can find of purely client side form validation. Is this just not the > Rails way? > > If people are still doing validation twice like I used to do then I''m > curious how they are handling it. Does it conflict with AJAX in any way?Hi Peter, There''s various schools of thought on this, and while I don''t necessarily speak for "The Rails Way (tm)" of doing it, I *think* a specific decision was made to do it server-side only in Rails. I think it basically stems from the fact that client-side JavaScript validation with alert boxes and so on can get rather unwieldy, and since you have to do server-side validation anyway, and since rails makes it so easy to do the server side validation, and since validating it in two different ways is rather un-DRY, I think that''s essentially the reason Rails uses server side validation only. I may be wrong about this, but I''m pretty sure this was what was said the last time this topic cropped up. Someone else please feel free to correct me! Having said that, I wouldn''t be surprised if someone makes a plugin to do this sometime, since it would probably be quite easy to automatically create the JavaScript validation code from the model validations themselves. I''m not certain I''m right about all this - just trying to answer your email since nobody else has yet! :-) Cheers, ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
On Fri, 2005-11-11 at 17:42 -0200, Alessandro Cauduro wrote:> Dave, > > Java/Struts (arghhhh), has a javascript error helper that generates > Javascript validation, as well as the standard server validation. > > It can be nice to have this option to lower the load on the server. But it > also means that custom validations will have to be translated to Javascript, > therefore giving double the amount of work (not DRY) for the same result.Client side validation also means you''re trusting that no-one will try to hack your get/post requests. Thats a pretty large trust. Javascript validations are only good for aesthetic reasons, and for situations where you think there will be alot of mistakes (I guess, since you don''t hit the server more than once). -Matt B> Alessandro > > -----Mensagem original----- > De: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] Em nome de Dave Silvester > Enviada em: sexta-feira, 11 de novembro de 2005 16:38 > Para: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Assunto: Re: [Rails] javascipt form validation in Rails > > On Thursday 10 Nov 2005 05:57, Peter Michaux wrote: > > In PHP I was validating twice: client side and then server side. Certainly > > the code was not DRY but it made the user experience quicker and saved > > server requests. I thought of the client side validation as optimization > of > > the application. In "Agile Web Development with Rails" there is no mention > > that I can find of purely client side form validation. Is this just not > the > > Rails way? > > > > If people are still doing validation twice like I used to do then I''m > > curious how they are handling it. Does it conflict with AJAX in any way? > > Hi Peter, > > There''s various schools of thought on this, and while I don''t necessarily > speak for "The Rails Way (tm)" of doing it, I *think* a specific decision > was > made to do it server-side only in Rails. > > I think it basically stems from the fact that client-side JavaScript > validation with alert boxes and so on can get rather unwieldy, and since you > > have to do server-side validation anyway, and since rails makes it so easy > to > do the server side validation, and since validating it in two different ways > > is rather un-DRY, I think that''s essentially the reason Rails uses server > side validation only. > > I may be wrong about this, but I''m pretty sure this was what was said the > last > time this topic cropped up. Someone else please feel free to correct me! > > Having said that, I wouldn''t be surprised if someone makes a plugin to do > this > sometime, since it would probably be quite easy to automatically create the > JavaScript validation code from the model validations themselves. > > I''m not certain I''m right about all this - just trying to answer your email > since nobody else has yet! :-) > > Cheers, > > ~Dave > > -- > > Dave Silvester > Rent-A-Monkey Website Development > Web: http://www.rentamonkey.com/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Dave, Java/Struts (arghhhh), has a javascript error helper that generates Javascript validation, as well as the standard server validation. It can be nice to have this option to lower the load on the server. But it also means that custom validations will have to be translated to Javascript, therefore giving double the amount of work (not DRY) for the same result. Alessandro -----Mensagem original----- De: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] Em nome de Dave Silvester Enviada em: sexta-feira, 11 de novembro de 2005 16:38 Para: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Assunto: Re: [Rails] javascipt form validation in Rails On Thursday 10 Nov 2005 05:57, Peter Michaux wrote:> In PHP I was validating twice: client side and then server side. Certainly > the code was not DRY but it made the user experience quicker and saved > server requests. I thought of the client side validation as optimizationof> the application. In "Agile Web Development with Rails" there is no mention > that I can find of purely client side form validation. Is this just notthe> Rails way? > > If people are still doing validation twice like I used to do then I''m > curious how they are handling it. Does it conflict with AJAX in any way?Hi Peter, There''s various schools of thought on this, and while I don''t necessarily speak for "The Rails Way (tm)" of doing it, I *think* a specific decision was made to do it server-side only in Rails. I think it basically stems from the fact that client-side JavaScript validation with alert boxes and so on can get rather unwieldy, and since you have to do server-side validation anyway, and since rails makes it so easy to do the server side validation, and since validating it in two different ways is rather un-DRY, I think that''s essentially the reason Rails uses server side validation only. I may be wrong about this, but I''m pretty sure this was what was said the last time this topic cropped up. Someone else please feel free to correct me! Having said that, I wouldn''t be surprised if someone makes a plugin to do this sometime, since it would probably be quite easy to automatically create the JavaScript validation code from the model validations themselves. I''m not certain I''m right about all this - just trying to answer your email since nobody else has yet! :-) Cheers, ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.12.8/166 - Release Date: 10/11/2005
On 11/10/05, Peter Michaux <petermichaux@gmail.com> wrote:> > Hi, > > In PHP I was validating twice: client side and then server side. Certainly > the code was not DRY but it made the user experience quicker and saved > server requests. I thought of the client side validation as optimization of > the application. In "Agile Web Development with Rails" there is no mention > that I can find of purely client side form validation. Is this just not the > Rails way? > > If people are still doing validation twice like I used to do then I''m > curious how they are handling it. Does it conflict with AJAX in any way? >With AJAX you can validate once without having to define validations in JavaScript. I''ve just published a text on exactly this subject: http://www.bigsmoke.us/ajax-validation-in-rails/ Note that the page is untested in IE. If you find anything missing in the text, please let me know. Cheers, Rowan -- Morality is usually taught by the immoral. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060329/0bc3acf0/attachment.html