Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

livevalidation.com

scottj97 edited this page · 5 revisions
Clone this wiki locally

Installation instructions

  • Install this plugin: ./script/plugin install git://github.com/augustl/live-validations.git
  • Download the javascripts from livevalidation.com, and store it as RAILS_ROOT/public/javascripts/livevalidation.js. Choose whether you want the stand-alone or the prototype version. If you use Rails’ built-in javascripts, you probably want the prototype version.
  • Add <%= javascript_include_tag "prototype", "livevalidation" %> to your layout(s).
  • Add LiveValidations.use :livevalidation_dot_com to an initializer, or at the bottom of environment.rb. Make sure it is outside of the Rails::Initializer block.
  • Add :live_validations => true to the forms you want to live validate. Example: <% form_for(@user, :live_validations => true) %>

Configuration options.

Setting Defaults: environment.rb

There are currently two defaults you can set for app-wide validation in your environment.rb file: default_valid_message and validate_on_blur. default_valid_message accepts a value for showing your user when their data passes validation. You can also set it to nil or an empty string. validate_on_blur is a boolean that determines when validation occurs. A setting of true means we validate on blur, after the user has tabbed out of the input, and a setting of false (the default) validates live as she types. For example:


LiveValidations.use :livevalidation_dot_com, :default_valid_message => 'Thanks!', :validate_on_blur => true

Something went wrong with that request. Please try again.