Class: Validator

greppy. Validator

new Validator()

Source:

Methods

addValidator(el) → {undefined}

Add a validator to the current set of validators.

Parameters:
Name Type Description
el type
Source:
Returns:
Type
undefined

bindAllEventsToValidator(validator)

Applies the defined events to the specified validator.

Parameters:
Name Type Description
validator jQuery
Source:

bindEvent(origEvtName, gEvtName)

Bind an event to trigger Greppy validator events.

Parameters:
Name Type Description
origEvtName String

Name of the event to be bound.

gEvtName String

May be 'gValidationInvalid' or 'gValidationUpdate'.

Source:

bindEventToValidator(validator, origEvtName, gEvtName)

This binds an element's event to a specified greppy Validator event.

Parameters:
Name Type Description
validator jQuery
origEvtName String
gEvtName String
Source:

getMark(el) → {jQuery}

Gets the element which should be marked if an error occurs.

Parameters:
Name Type Description
el jQuery

The validator.

Source:
Returns:
Type
jQuery

hasActiveMsg(el) → {Boolean}

Returns wether the passed element has an active message.

Parameters:
Name Type Description
el jQuery
Source:
Returns:
Type
Boolean

init()

Initializes greppy validators.

Source:

markInvalid(el)

Marks the provided element as invalid.

Parameters:
Name Type Description
el Object
Source:

removeInvalidMark(el)

Removes an invalid mark from the provided element.

Parameters:
Name Type Description
el Object
Source:

removeMsg(el, fast)

Removes the msg-element of a provided mark element, if there's any.

Parameters:
Name Type Description
el Object

The mark element

fast Boolean

No fading out; fast removing.

Source:

showMsg(el)

Shows the validation message of a provided element.

Parameters:
Name Type Description
el type
Source:

validate(el)

Validates an element.

Parameters:
Name Type Description
el Object

The element to validate.

Source: