Language: Ruby


Build Status

ClientSideValidations made easy for your Rails applications!

In addition to this README please checkout the wiki and ClientSideValidations GoogleGroup.

Project Goals

  1. Follow the best practices for client side validations developed by Luke Wroblewski
  2. Automatically extract and apply validation rules defined on the server to the client.
  3. In the cases where a server-side validation rule would not work on the client (i.e. conditional callbacks like :if, :unless) then do not attempt client side validations. Fall back to the server side validation.
  4. The client side validation error rendering should be indistinguishable from the server side validation error rendering.
  5. Wide browser compliancy. I've tested with IE8, seems to work OK.
  6. Work with any ActiveModel::Validations based model
  7. Validate nested fields
  8. Support custom validations
  9. Client side validation callbacks


Include ClientSideValidations in your Gemfile

gem 'client_side_validations'

Then run the install generator

rails g client_side_validations:install

This will install the initializer:


If you are using Rails 3.1+ you'll need to use:

rails g client_side_validations:copy_assets


The javascript file is served up in the asset pipeline. Add the following to your app/assets/javascripts/application.js file.

//= require rails.validations


The initializer includes a commented out ActionView::Base.field_error_proc. Uncomment this to render your error messages inline with the input fields.

I recommend you not use a solution similar to error_messages_for. Client Side Validations is never going to support rendering these type of error messages. If you want to maintain consistency between the client side rendered validation error messages and the server side rendered validation error messages please use what is in config/initializers/client_side_validations.rb

Client Side Validation Callbacks

See the wiki


There is additional support for other ActiveModel based ORMs and other Rails FormBuilders. Please see the Plugin wiki page


Brian Cardarella


This gem follows Semantic Versioning

Major and minor version numbers will follow Rails's major and minor version numbers. For example, client_side_validations-3.2.0 will be compatible up to ~> rails-3.2.0

We will maintain compatibility with one minor version back. So the 3.2.0 version of client_side_validations will be compatible with ~> rails-3.1.0

Only two versions minor versions will be actively maintained.

Want to help?

Stable branches are created based upon each minor version. Please make pull requests to specific branches rather than master.

Please make sure you include tests!

Unles Rails drops support for Ruby 1.8.7 we will continue to use the hash-rocket syntax. Please respect this.

Don't use tabs to indent, two spaces are the standard.


DockYard, LLC © 2012


Licensed under the MIT license

Project Statistics

Sourcerank 1
Repository Size 632 KB
Stars 0
Forks 0
Watchers 0
Open issues 0
Dependencies 11
Contributors 16
Tags 41
Last updated

Top Contributors See all

Brian Cardarella Taavo Smith Mattias Pfeiffer Jon Kessler Ivan Storck Mikael Henriksson Godisemo Ashwin Mangale Jeff Casimir Milan Burmaja Mike Vastola Erik Ostrom Eugene Pirogov Vojtěch Hýža Mathieu Arnold Paul Covell

Recent Tags See all

v3.2.0.beta.2 January 25, 2012
v3.2.0.beta.1 January 22, 2012
v3.1.4 December 22, 2011
v3.1.3 November 01, 2011
v3.1.2 October 31, 2011
v3.1.1 October 25, 2011
v3.0.12 June 23, 2011
v3.0.11 June 22, 2011
v3.1.0 June 20, 2011
v3.1.0.rc.3 June 20, 2011
v3.0.10 June 20, 2011
v3.0.9 June 20, 2011
v3.0.8 June 20, 2011
v3.0.7 June 17, 2011
v3.0.6 June 17, 2011

Something wrong with this page? Make a suggestion

Login to resync this repository