From c82a821c03ddf51c72b28419345e6a4dd81f0c66 Mon Sep 17 00:00:00 2001 From: Danillo Bion Date: Thu, 20 May 2021 18:46:54 -0300 Subject: [PATCH] validacao cpf e rg --- .../views/evento/submeterTrabalho.blade.php | 52 ++++++++++++++++--- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/resources/views/evento/submeterTrabalho.blade.php b/resources/views/evento/submeterTrabalho.blade.php index 4f150aa..5fc6c71 100644 --- a/resources/views/evento/submeterTrabalho.blade.php +++ b/resources/views/evento/submeterTrabalho.blade.php @@ -643,7 +643,7 @@ var countParticipante = document.getElementById('countParticipante'); if (countParticipante.value < limiteMaxParticipantes) { e.preventDefault(); - linha = montarLinhaInput(); + linha = montarLinhaInput(parseInt(countParticipante.value) + 1); $('#participantes').append(linha); setParticipanteDiv(parseInt(countParticipante.value) + 1); @@ -792,7 +792,7 @@ // } // } - function montarLinhaInput() { + function montarLinhaInput(valor) { return `
@@ -810,7 +810,7 @@
- + @error('nomeParticipante.'.$i) {{ $message }} @@ -840,15 +840,22 @@
- + +
- + +
- + +
@@ -1236,11 +1243,42 @@ function verificarArquivoAnexado_xls_xlsx_ods(item){ function validarForm(){ var buttonRadioSim = document.getElementById("radioSim"); var buttonRadioNao = document.getElementById("radioNao"); + + //button radio if(buttonRadioSim.checked == false && buttonRadioNao.checked == false){ document.getElementById("idAvisoAutorizacaoEspecial").style.display = "block"; + } +} +var novoRG = ""; +function verificaCampos(input, tipo){ + if(tipo == "cpf"){ + var regExp = /^\d{3}\.\d{3}\.\d{3}\-\d{2}$/g; + if(regExp.test(input.value) == false){ + document.getElementById(input.id).style.borderColor = "red"; + document.getElementById("idAvisoCpfParticipante"+input.id).style.display="block"; + }else{ + document.getElementById(input.id).style.borderColor = "#c6c8ca"; + document.getElementById("idAvisoCpfParticipante"+input.id).style.display="none"; + } + }else if(tipo == "rg"){ + var regExp = /[0-9]$/g; + if(regExp.test(input.value) == false){ + document.getElementById(input.id).style.borderColor = "red"; + document.getElementById("idAvisoRgParticipante"+input.id).style.display="block"; + }else{ + document.getElementById(input.id).style.borderColor = "#c6c8ca"; + document.getElementById("idAvisoRgParticipante"+input.id).style.display="none"; + } } } - + + +function isNumber(n) { + return !isNaN(parseFloat(n)) && isFinite(n); +} + + + @endsection -- GitLab