This repository was archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
jQuery Validations
manuelmeurer edited this page Sep 12, 2010
·
6 revisions
- Install this plugin:
./script/plugin install git://github.com/augustl/live-validations.git - Download jQuery and the jQuery Validations jQuery plugin, and put them in RAILS_ROOT/public/javascripts.
- Add
<%= javascript_include_tag "jquery", "jquery.validate" %>to your layout(s). - Add
LiveValidations.use :jquery_validationsto an initializer (e.g. RAILS_ROOT/config/initializers/app.rb) or at the bottom of RAILS_ROOT/config/environment.rb. - Add
:live_validations => trueto the forms you want to live validate. Example:<% form_for(@user, :live_validations => true) %>
validator_settings: Any option here is passed directly onto the validate method in the javascripts. Refer to the documentation for a full list of what you can do here (it’s a lot). Example:
LiveValidations.use :jquery_validations, :validator_settings => {:debug => true, :onsubmit => false, :errorClass => "invalid"}