From 07dd5804b6f9ac7d77eb492f7f82441612831a55 Mon Sep 17 00:00:00 2001 From: Giuli1297 Date: Wed, 10 Nov 2021 11:19:23 -0300 Subject: [PATCH] Algunas validaciones en el form --- curriculumsearch/src/main/resources/static/main.js | 23 ++++++++++++++--------- curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp | 2 +- curriculumsearch/src/main/webapp/jsp/postulante-form.jsp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++------------------- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/curriculumsearch/src/main/resources/static/main.js b/curriculumsearch/src/main/resources/static/main.js index 749e74c..1074539 100644 --- a/curriculumsearch/src/main/resources/static/main.js +++ b/curriculumsearch/src/main/resources/static/main.js @@ -4,6 +4,7 @@ let cont_tecnologia = 0; const experiencias = []; const estudios = []; const tecnologias = []; +let noValidateFlag = false; const formValidator = function () { 'use strict' @@ -20,6 +21,7 @@ const formValidator = function () { if (!form.checkValidity()) { event.preventDefault() event.stopPropagation() + noValidateFlag = true; } form.classList.add('was-validated') @@ -225,15 +227,18 @@ form.addEventListener("submit",(evt)=>{ // evt.stopPropagation() // } // form.classList.add('was-validated') - postData('postulante', serializeJSON(form)) - .then(response => { - if(response.status==200 || response.status==302){ - location.replace(response.url); - }else{ - console.log(response.text().then(value => console.log(value))) - } - }); - evt.preventDefault(); + if(!noValidateFlag){ + postData('postulante', serializeJSON(form)) + .then(response => { + if(response.status==200 || response.status==302){ + location.replace(response.url); + }else{ + console.log(response.text().then(value => console.log(value))) + } + }); + evt.preventDefault(); + } + noValidateFlag = false } ); document.querySelector("#btn-new-tech").addEventListener('click',()=>{document.querySelector("#tecnologia-nombre").classList.remove('d-none')}) diff --git a/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp b/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp index 1ebe5d2..09ceb9d 100644 --- a/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp +++ b/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp @@ -16,7 +16,7 @@


-
+



diff --git a/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp b/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp index 63b3b5f..e6f19ca 100644 --- a/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp +++ b/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp @@ -234,11 +234,11 @@
@@ -312,22 +312,22 @@
- - + +
- - + +
- - + +
- +
@@ -434,8 +434,8 @@ <%-- --%> <%-- --%>
- - + +
@@ -451,12 +451,12 @@
- - + +
- - + +
@@ -480,7 +480,38 @@ -- libgit2 0.26.0