Class: Validatinator

Validatinator

new Validatinator(validations, errorMessagesopt)

Core Validatinator class
Parameters:
Name Type Attributes Description
validations Object Keys: form's name attribute
Properties
Name Type Description
formName Object Keys: form's field name attribute
Properties
Name Type Description
fieldname string String containing field validations
errorMessages Object <optional>
Properties
Name Type Attributes Description
formName Object <optional>
Properties
Name Type Attributes Description
validationName string <optional>
New Validation error message
Since:
  • 0.1.0-beta
Source:

Members

messages

Object containing functionality for dealing with validation messages.
Since:
  • 0.1.0-beta
Mixes In:
Source:

utils

Object containing utilities used throughout Validatinator.
Since:
  • 0.1.0-beta
Mixes In:
Source:

validations

Object containing all core validation methods.
Since:
  • 0.1.0-beta
Mixes In:
Source:

Methods

fails(formName) → {Boolean}

Tests to see if the supplied form's values are not valid.
Parameters:
Name Type Description
formName string String representation of the form's name attr.
Since:
  • 0.1.0-beta
Source:
See:
  • startValidations
Returns:
True if the form fails validation, else False.
Type
Boolean

getValidationMethodAndParameters(validationString) → {Array.<string>}

Splits apart a validation string to retrieve it's validation method name along with any params it requires.
Parameters:
Name Type Description
validationString string String containing a validation method's signature, along with it's params supplied following a colon `:`.
Since:
  • 0.1.0-beta
Source:
Returns:
Array containing the validation method in the first index and all other indice are the validation method's params.
Type
Array.<string>

passes(formName) → {Boolean}

Tests to see if the supplied form's values are valid.
Parameters:
Name Type Description
formName string String representation of the form's name attr.
Since:
  • 0.1.0-beta
Source:
See:
  • startValidations
Returns:
True if the form passes validation, else False.
Type
Boolean

prepareParameters(params) → {Array.<Any>}

Prepares the parameter(s) so they can be used when making the validation method call.
Parameters:
Name Type Description
params string String containing params separated by colons. (e.g. "param1:param2:param3:param4")
Since:
  • 0.1.0-beta
Source:
Returns:
Type
Array.<Any>

startValidations(formName) → {Boolean}

Tests to see if the supplied form's values are valid.
Parameters:
Name Type Description
formName string String representation of the form's name attr.
Since:
  • 0.1.0-beta
Source:
Returns:
True if the form passes validation, else False.
Type
Boolean