API Docs for:
Show:

Validator Class

Defined in: parsley.js:11

Validator class stores all constraints functions and associated messages. Provides public interface to add, remove or modify them

Constructor

Validator

()

Defined in parsley.js:11

Item Index

Properties

Methods

addMessage

(
  • name
  • message
)

Defined in parsley.js:283

Add / override error message

Parameters:

  • name String

    Message name. Will automatically be binded to validator with same name

  • message String

    Message

addValidator

(
  • name
  • fn
)

Defined in parsley.js:272

Add / override a validator in validators list

Parameters:

  • name String

    Validator name. Will automatically bindable through data-name=''

  • fn Function

    Validator function. Must return {Boolean}

formatMesssage

(
  • message
  • args
)
String

Defined in parsley.js:251

Replace %s placeholders by values

Parameters:

  • message String

    Message key

  • args Mixed

    Args passed by validators functions. Could be string, number or object

Returns:

String:

Formatted string

Properties

messages

Object

Defined in parsley.js:19

Error messages

validators

Object

Defined in parsley.js:60

Validator list. Built-in validators functions