Skip to content
wxjaqy edited this page Apr 7, 2012 · 7 revisions

To start using client_side_validations you need to be using jQuery

  1. Add rails.validations.js to your layout
<%= javascript_include_tag 'jquery', 'rails' 'rails.validations' -%>
  1. Tell a form that you want to turn on validations
<%= form_for @person, :validate => true do |person| -%>

ClientSideValidations only works within the context of a form builder. So using the form_tag method will not work.

Also, while ClientSideValidations supports nested fields it will only work with the form builder's fields_for method, not the stand alone.

Clone this wiki locally