- Source:
Classes
Members
(static) stateEnum :object
An Enum with 3 states: invalid , pending , valid .
Type:
- object
- Source:
Example
stateEnum.invalid
(static) .validatorsNameOptionsTuple :array
An Array where Array[0] is the validator {string} name, and Array[1] is the validator {object} options
Type:
- array
Example
['required',{msg: 'custom required message'}]
Methods
(static) .defaultOnInputValidationResult()
The default onInputValidationResult used when vivalid.Input is initiated without a 3rd parameter
(static) .onAfterValidation(el)
A function to be called after triggering all of the input's validators
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | the input's DOM object. |
- Source:
(static) .onBeforeValidation(el)
A function to be called before triggering any of the input's validators
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | the input's DOM object. |
- Source:
(static) .onInputValidationResult(el, validationsResult, validatorName, stateEnum)
A function to handle an input state or message change
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement | the input's DOM object. |
validationsResult |
object | A ValidationState instance containing the state and validation message. |
validatorName |
string | The name of validator that triggered an 'invalid' state. |
stateEnum |
object | stateEnum |
(static) .onValidationFailure(invalid, pending, valid)
IMPORTANT - the 'this' context inside: {HTMLElement} of the original submitElem that triggered the validation
Parameters:
Name | Type | Description |
---|---|---|
invalid |
number | number of invalid inputs |
pending |
number | number of pending inputs |
valid |
number | number of valid inputs |
- Source:
(static) .onValidationSuccess()
IMPORTANT - the 'this' context inside: {HTMLElement} of the original submitElem that triggered the validation
- Source:
(static) .pendingUiStart(inputElems, submitElems, resetElems)
IMPORTANT - the 'this' context inside: {HTMLElement} of the original submitElem that triggered the validation
Parameters:
Name | Type | Description |
---|---|---|
inputElems |
Array.<HTMLElement> | the group's input elements |
submitElems |
Array.<HTMLElement> | the group's submit elements |
resetElems |
Array.<HTMLElement> | the group's _reset elements |
- Source:
(static) .pendingUiStop(inputElems, submitElems, resetElems)
IMPORTANT - the 'this' context inside: {HTMLElement} of the original submitElem that triggered the validation
Parameters:
Name | Type | Description |
---|---|---|
inputElems |
Array.<HTMLElement> | the group's input elements |
submitElems |
Array.<HTMLElement> | the group's submit elements |
resetElems |
Array.<HTMLElement> | the group's _reset elements |
- Source: