-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathasunto.js
53 lines (32 loc) · 1.23 KB
/
asunto.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var asunto = document.querySelector("#asunto");
asunto.addEventListener("keyup", function (evento) {
console.log(`Contenido del asunto: ${asunto.value} `);
if (asuntoError.vacio == false) {
if (validarVacio(asunto.value)) {
mostrarTextoErrorVacio("asunto", "error-asuntoVacio");
asuntoError.vacio = true;
}
} else {
if (validarEntrada(evento.key)){
borrarElemento("error-asuntoVacio");
asuntoError.vacio = false;
}
}
if (asuntoError.longitud == false) {
if (validarLongitud(asunto.value, 50) == false) {
mostrarTextoErrorLongitud("asunto", "error-asuntoLongitud", 50);
asuntoError.longitud = true;
}
} else if (validarLongitud(asunto.value, 50)) {
borrarElemento("error-asuntoLongitud");
asuntoError.longitud = false;
}
if ((asuntoError.longitud == false) && (asuntoError.vacio == false)) {
asuntoError.estado = true;
} else {
asuntoError.estado = false;
}
/* console.log(`Estado longitud: ${asuntoError.longitud} y Estado Vacio: ${asuntoError.vacio}`)
console.log(`Estado del error ${asuntoError.estado}`); */
verificarEstado();
})