src/jquery.validation.js
function validateInput(input, value) {

            var inputName = $(input).attr('name'),
                value = value || _getInputValue(input);

            if (!inputName) {

                // {debug}
                options.debug && window.Debug.log({
                    'node': node,
                    'function': 'validateInput()',
                    'arguments': '$(input).attr("name")',
                    'message': 'ERROR - Missing input [name]'
                });
                // {/debug}

                return false;
            }

            var matches = inputName.replace(/]$/, '').split(/]\[|[[\]]/g),
                inputShortName = window.Validation.labels[inputName] ||
                    options.labels[inputName] ||
                    $(input).attr(_data.label) ||
                    matches[matches.length - 1],

                validationArray = $(input).attr(_data.validation),
                validationMessage = $(input).attr(_data.validationMessage),
                validationRegex = $(input).attr(_data.regex),
                validationRegexReverse = !($(input).attr(_data.regexReverse) === undefined),
                validationRegexMessage = $(input).attr(_data.regexMessage),

                validateOnce = false;

            if (validationArray) {
                validationArray = _api._splitValidation(validationArray);
            }

            // Validates the "data-validation"
            if (validationArray instanceof Array && validationArray.length > 0) {

                // "OPTIONAL" input will not be validated if it's empty
                if ($.trim(value) === '' && ~validationArray.indexOf('OPTIONAL')) {
                    return true;
                }

                $.each(validationArray, function (i, rule) {

                    if (validateOnce === true) {
                        return true;
                    }

                    try {

                        validateRule(value, rule);

                    } catch (error) {

                        if (validationMessage || !options.submit.settings.allErrors) {
                            validateOnce = true;
                        }

                        error[0] = validationMessage || error[0];

                        registerError(inputName, error[0].replace('$', inputShortName).replace('%', error[1]));

                    }

                });

            }

            // Validates the "data-validation-regex"
            if (validationRegex) {

                var rule = _buildRegexFromString(validationRegex);

                // Do not block validation if a regexp is bad, only skip it
                if (!(rule instanceof RegExp)) {
                    return true;
                }

                try {

                    validateRule(value, rule, validationRegexReverse);

                } catch (error) {

                    error[0] = validationRegexMessage || error[0];

                    registerError(inputName, error[0].replace('$', inputShortName));

                }

            }

            return !errors[inputName] || errors[inputName] instanceof Array && errors[inputName].length === 0;

        }
function validateInput(input, value) {

            var inputName = $(input).attr('name'),
                value = value || _getInputValue(input);

            if (!inputName) {

                // {debug}
                options.debug && window.Debug.log({
                    'node': node,
                    'function': 'validateInput()',
                    'arguments': '$(input).attr("name")',
                    'message': 'ERROR - Missing input [name]'
                });
                // {/debug}

                return false;
            }

            var matches = inputName.replace(/]$/, '').split(/]\[|[[\]]/g),
                inputShortName = window.Validation.labels[inputName] ||
                    options.labels[inputName] ||
                    $(input).attr(_data.label) ||
                    matches[matches.length - 1],

                validationArray = $(input).attr(_data.validation),
                validationMessage = $(input).attr(_data.validationMessage),
                validationRegex = $(input).attr(_data.regex),
                validationRegexReverse = !($(input).attr(_data.regexReverse) === undefined),
                validationRegexMessage = $(input).attr(_data.regexMessage),

                validateOnce = false;

            if (validationArray) {
                validationArray = _api._splitValidation(validationArray);
            }

            // Validates the "data-validation"
            if (validationArray instanceof Array && validationArray.length > 0) {

                // "OPTIONAL" input will not be validated if it's empty
                if ($.trim(value) === '' && ~validationArray.indexOf('OPTIONAL')) {
                    return true;
                }

                $.each(validationArray, function (i, rule) {

                    if (validateOnce === true) {
                        return true;
                    }

                    try {

                        validateRule(value, rule);

                    } catch (error) {

                        if (validationMessage || !options.submit.settings.allErrors) {
                            validateOnce = true;
                        }

                        error[0] = validationMessage || error[0];

                        registerError(inputName, error[0].replace('$', inputShortName).replace('%', error[1]));

                    }

                });

            }

            // Validates the "data-validation-regex"
            if (validationRegex) {

                var rule = _buildRegexFromString(validationRegex);

                // Do not block validation if a regexp is bad, only skip it
                if (!(rule instanceof RegExp)) {
                    return true;
                }

                try {

                    validateRule(value, rule, validationRegexReverse);

                } catch (error) {

                    error[0] = validationRegexMessage || error[0];

                    registerError(inputName, error[0].replace('$', inputShortName));

                }

            }

            return !errors[inputName] || errors[inputName] instanceof Array && errors[inputName].length === 0;

        }
function validateInput ( input , value ) { var inputName = $ ( input ) . attr ( 'name' ) , value = value || _getInputValue ( input ) ; if ( ! inputName ) { // {debug} options . debug && window . Debug . log ( { 'node' : node , 'function' : 'validateInput()' , 'arguments' : '$(input).attr("name")' , 'message' : 'ERROR - Missing input [name]' } ) ; // {/debug} return false ; } var matches = inputName . replace ( / ]$ / , '' ) . split ( / ]\[|[[\]] / g ) , inputShortName = window . Validation . labels [ inputName ] || options . labels [ inputName ] || $ ( input ) . attr ( _data . label ) || matches [ matches . length - 1 ] , validationArray = $ ( input ) . attr ( _data . validation ) , validationMessage = $ ( input ) . attr ( _data . validationMessage ) , validationRegex = $ ( input ) . attr ( _data . regex ) , validationRegexReverse = ! ( $ ( input ) . attr ( _data . regexReverse ) === undefined ) , validationRegexMessage = $ ( input ) . attr ( _data . regexMessage ) , validateOnce = false ; if ( validationArray ) { validationArray = _api . _splitValidation ( validationArray ) ; } // Validates the "data-validation" if ( validationArray instanceof Array && validationArray . length > 0 ) { // "OPTIONAL" input will not be validated if it's empty if ( $ . trim ( value ) === '' && ~ validationArray . indexOf ( 'OPTIONAL' ) ) { return true ; } $ . each ( validationArray , function ( i , rule ) { if ( validateOnce === true ) { return true ; } try { validateRule ( value , rule ) ; } catch ( error ) { if ( validationMessage || ! options . submit . settings . allErrors ) { validateOnce = true ; } error [ 0 ] = validationMessage || error [ 0 ] ; registerError ( inputName , error [ 0 ] . replace ( '$' , inputShortName ) . replace ( '%' , error [ 1 ] ) ) ; } } ) ; } // Validates the "data-validation-regex" if ( validationRegex ) { var rule = _buildRegexFromString ( validationRegex ) ; // Do not block validation if a regexp is bad, only skip it if ( ! ( rule instanceof RegExp ) ) { return true ; } try { validateRule ( value , rule , validationRegexReverse ) ; } catch ( error ) { error [ 0 ] = validationRegexMessage || error [ 0 ] ; registerError ( inputName , error [ 0 ] . replace ( '$' , inputShortName ) ) ; } } return ! errors [ inputName ] || errors [ inputName ] instanceof Array && errors [ inputName ] . length === 0 ; }
Prepare the information from the data attributes
and call the "validateRule" function.

@param {Object} input Reference of the input element

@returns {Boolean} true if no error(s) were found (valid input)
Prepare the information from the data attributes and call the validateRule function .