0
I have this Submit from my form that comes from php
, wanted to validate two fields within it the of cnpj and date. How to do?
$("#more").submit(function repeatLink (event) {
event.preventDefault();
alert('estou aqui');
var link = $("#link").val();
var date = $("#date-foundation").val();
var validation = true;
if (link === null || link === '') {
$("#link").addClass("input-required");
validation = false;
}
if (validation === true) {
$.ajax({
url: './model/functions/link_repeat.php',
type: 'POST',
data: {link: link},
success: function (data) {
alert(data);
if (data === 'true') {
$("#link").addClass("input-required");
$("#alert-link").append("<span style='color:red'><b>Esse link já existe! Escolha outro!</b></span>");
return;
}
}
});
}
})
Curti, returns true to 11.111.111/1111-80
– epx
In fact what makes a cnpj, Cpf rg, etc., valid, are the digit checkers, which are calculated based on the rest of the numbers. Roughly if the checkers match, it is because the number ta in the correct "format".
– Neuber Oliveira