Does ruby on rails have client side validation like ASP.NET MVC [duplicate]

痞子三分冷 提交于 2019-12-11 02:05:31

问题


In ASP.NET MVC you can setup client side validations with the data annotations model which is similar to validations in ruby on rails. However there are unobtrusive javascript hooks created that will automatically wire up client side validations on forms. Is there anything like this for Ruby on Rails?


回答1:


I was wondering this just the other day, and I found this awesome blog post about it!

http://sleekd.com/tutorials/jquery-validation-in-ruby-on-rails/

The short answer is yes, and the long answer is in the blogpost!

Andy




回答2:


You can try my ClientSideValidations gem: https://github.com/bcardarella/client_side_validations

And there is Railscast about it: http://railscasts.com/episodes/263-client-side-validations



来源:https://stackoverflow.com/questions/5384506/does-ruby-on-rails-have-client-side-validation-like-asp-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!