ClientSideValidations made easy for your Rails applications!
- Follow the best practices for client side validations developed by Luke Wroblewski
- Automatically extract and apply validation rules defined on the server to the client.
- 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.
- The client side validation error rendering should be indistinguishable from the server side validation error rendering.
- Wide browser compliancy. I've tested with IE8, seems to work OK.
- Work with any ActiveModel::Validations based model
- Validate nested fields
- Support custom validations
- Client side validation callbacks
ClientSideValidations in your Gemfile
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_asset
following to your
//= require rails.validations
The initializer includes a commented out
Uncomment this to render your error messages inline with the input fields.
I recommend you not use a solution similar to
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
Client Side Validation Callbacks
There is additional support for other
ActiveModel based ORMs and other
FormBuilders. Please see the Plugin wiki page
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
We will maintain compatibility with one minor version back. So the 3.2.0 version of
client_side_validations will be compatible with
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!
Unless 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