I'm trying to create a validation function inside ValidationEngine, however I'm getting this error:
Uncaught TypeError: Can not read property 'validDocument' of undefined
E I can not identify the problem. I have another site using the same function, and I can not see where I'm going wrong.
My code:
<!DOCTYPE html>
<html class="no-js" lang="pt-br">
<head>
<title>Teste</title>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script><scriptsrc="http://code.jquery.com/jquery-migrate-1.4.0.js"></script>
<script src="/site/js/script/validationEngine/jquery.validationEngine.js"></script>
<script src="/site/js/script/validationEngine/jquery.validationEngine-pt-BR.js"></script>
</head>
<body>
<script>
$(function(){
$(".validar").validationEngine("attach");
function validaDocumento(field, rules, i, options){ return true; }
$(this).submit(function(e){ e.preventDefault(); });
});
</script>
<form method="POST" class="validar formConsulta">
<label>CPF/CNPJ:</label>
<input type="text" class="validate[funcCall[validaDocumento]]" data-errormessage="Documento invalido!" />
<input type="submit" value="Consultar">
</form>
</body>
</html>
Link to access code: link
I have tried to change the order of Javascript (put on top, on the head, after all, reverse the functions) and always gives the same error.
What can I do to remedy the problem?