1
I am trying to create a validation function within Validationengine, however I am getting this error:
Uncaught Typeerror: Cannot read Property 'validaDocument' of Undefined
And I can’t identify what the problem is. I have another site using the same function, and I can’t 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>
<script src="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 the code: https://codepen.io/maykelesser/pen/zEgovq
I tried to change the order of Javascript (put on top, in the head, below everything, reverse functions) and always gives the same error.
What can I do to fix the problem?
Perfect! Thank you very much! I will apply to the actual code now ;-)
– Maykel Esser