Form Validation Toolkit

Validation Result Data

When onSubmission or onChange validation is checked for a field or the form, result data is collected and stored at the element and form level.

If the validation process is not attached to the FORM and instead a set of fields have been attached to it, the process will still attempt to find the parent form and find/store the validation status of each element and the form.

Form's Validation Result Data

The process stores two variables in the form's jQuery data:
$('form').data('valStatus'): Boolean. It tells whether all items in the form passed validation or not.
$('form').data('valResult'): Array. It stores the validation result in an array for each field in the form with validation attributes. Each array item has a result object with these keys:
el: The element (jQuery) that was validated
passed: Result of validation - true or false
error: An array with the error code and error description

[
    {
        el: [object],
        passed: true,
        error: []
    },
    {
        el: [object],
        passed: false,
        error: [["100-1", "Require validation failed."]]
    }
]

FIELD's Validation Result Data

The process stores two variables in the fields's jQuery data:
$('field').data('valStatus'): Boolean. It tells whether all items in the form passed validation or not.
$('field').data('valResult'): Object. It stores the validation result in a result object with these keys:
passed: Result of validation - true or false
error: An array with the error code and error description
{
    passed: true,
    error: ['']
}