HTTPS SSH
VALIDAYSHAN
===========
A JavaScript validation bootstrapping shizzle.

INTRODUCTION
------------
Validayshan provides a simple non-intrusive client-side validation framework in
a require.js-enabled ARM module. Minimal coding is needed to enable it,
everything else is done through neatly namespaced classes and data attributes.
Because the namespace prefix is customizable, Validayshan will *never* step on
any other code's toes.

USAGE
-----
* Set up a require.js project.
* If you haven't already, add jQuery to your project as per the instructions
  from require.js. Expose it under the module name 'jquery' (this is actually
  kind of mandatory for Validayshan to function properly).
* Download validayshan.js and add it to your require.js project.
* Somewhere in your own code, call the `attach()` function from the validayshan
  module, with a suitable namespace. E.g.:

    // the usual require stuff
    require(['jquery', 'validayshan'], function($, validayshan) {
        // wrap stuff in the ready event for good form
        $(document).ready(function(){
            // attach Validayshan to the current document
            validayshan.attach('v');
        });
    });

* In order to have validayshan actually do something, you need to write
  suitable HTML. Specifically, you need:
  * A `<form>` element
  * Inside that form, several fields, each consisting of:
    * Some element that acts as a field wrapper (grouping the other components
      together); mark the wrapper with the class `v-field` (assuming `v-` is
      your chosen namespace). The wrapper can be anything, as long as it's
      valid per the HTML specification.
    * Exactly one `<input>` element with the `v-target` class, inside the
      wrapper.
    * One or more arbitrary elements with the `v-validator` class, also inside
      the wrapper. Additional attributes are required to make this work; for a
      simple required-field validator, set the `data-v-type` attribute to
      `"required"`.
  * Some CSS rules to hide the validators by default, and show them if the
    `.v-active` class is set (this is how Validayshan marks fields as invalid).
    Something like this should work:

      .v-validator { display: none; }
      .v-validator.v-active { display: inline; }

    However, your needs may vary depending on what other CSS you have in place.

VALIDATORS
----------
Validayshan provides a few validators out-of-the-box; at the time of writing,
these are:

- `required` - A required field. Considered valid if it contains at least one
  non-whitespace character.
- `int` - An integer in decimal notation, with an optional leading negative
  sign.
- `decimal` - A decimal fraction.
- `alphanumeric` - What it says: alphanumeric characters only. Leading and
  trailing whitespace allowed.
- `regex` - Read the `data-v-regex` attribute and use it as a regular
  expression. Field is considered valid if the regex matches, or if it is empty.