Rails 3 Client Side Validations

Project Goals

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.

Nested fields automatically inherit the :validate value. If you want to
turn it off just pass :validate => false to fields_for

<%= book.fields_for :pages, :validate => falsedo |page| -%>

Initializer

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