Rails 4 client side validation

tblakey89 picture tblakey89 · Jan 10, 2014 · Viewed 19.7k times · Source

Since upgrading my site to Rails 4, the client-side-validations gem has stopped working for me. I have had a look at the various alternatives such as jquery-validation-rails and judge, which involve writing quite a bit of javascript, especially for a site so large. And in the case of jquery-validation-rails, re-doing all the validation rules client side. Considering Rails is such a popular framework, it surprises me that there is no 'easy' option. Is there any gem which anyone else is aware of, which does validation as well as the client-side-validation gem?

Or is the best alternative to use the ModelName.validators method mixed with some ajax, and do the validation through the jquery-validation-rails gem?

Answer

Beartech picture Beartech · Jan 10, 2014

From the Google.

http://rubygems.org/gems/rails4_client_side_validations

https://github.com/amatsuda/html5_validators

Also this guy seemed to have gotten the same gem you are using to work by using the 4-0-beta branch.

Client Side Validations and Rails4

If the 4-0-beta branch works for you, consider helping to maintain the gem to keep it alive.

To use a certain git repo version in your Gemfile:

gem 'client-side-validations', :git => 'https://github.com/bcardarella/client_side_validations/tree/4-0-beta'