Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
117 lines (117 loc) · 3.49 KB
/
Copy pathscript.js
File metadata and controls
117 lines (117 loc) · 3.49 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
1 / 3;
// validacion de los campos input "text" obligatorios
function validacionFormulario() {
primerNombre = document.getElementById("PrimerNombre");
if (
primerNombre == null ||
primerNombre.length == 0 ||
/^\s+$/.test(primerNombre)
) {
alert("Primer nombre inválido");
return false;
}
primerApellido = document.getElementById("PrimerApellido").value;
if (
primerApellido == null ||
primerApellido.length == 0 ||
/^\s+$/.test(primerApellido)
) {
alert("Primer apellido inválido");
return false;
}
fechaNacimiento = document.getElementById("FechaNacimiento").value;
if (
fechaNacimiento == null ||
fechaNacimiento.length == 0 ||
/^\s+$/.test(fechaNacimiento)
) {
alert("Fecha de nacimiento inválido");
return false;
}
lugarNacimiento = document.getElementById("LugarNacimiento").value;
if (
lugarNacimiento == null ||
lugarNacimiento.length == 0 ||
/^\s+$/.test(lugarNacimiento)
) {
alert("Lugar de nacimiento inválido");
return false;
}
numIdentificacion = document.getElementById("NumIdentificacion").value;
if (
numIdentificacion == null ||
numIdentificacion.length == 0 ||
/^\s+$/.test(numIdentificacion)
) {
alert("Número de identificación inválido");
return false;
}
direccion = document.getElementById("Direccion").value;
if (direccion == null || direccion.length == 0 || /^\s+$/.test(direccion)) {
alert("Dirección inválida");
return false;
}
casa = document.getElementById("Casa").value;
if (casa == null || casa.length == 0 || /^\s+$/.test(casa)) {
alert("Casa inválida");
return false;
}
telPrimario = document.getElementById("TelPrimario").value;
if (
telPrimario == null ||
telPrimario.length == 0 ||
/^\s+$/.test(telPrimario)
) {
2 / 3;
alert("Telefono primario inválido");
return false;
}
contraseña = document.getElementById("Contraseña").value;
if (
contraseña == null ||
contraseña.length == 0 ||
/^\s+$/.test(contraseña)
) {
alert("Contraseña inválida");
return false;
}
// validaciones de las listas
genero = document.getElementById("Genero").selectedIndex;
if (genero == null || genero == 0) {
alert("Género inválido");
return false;
}
estadoCivil = document.getElementById("EstadoCivil").selectedIndex;
if (estadoCivil == null || estadoCivil == 0) {
alert("Estado Civil inválido");
return false;
}
identificacion = document.getElementById("Identificacion").selectedIndex;
if (identificacion == null || identificacion == 0) {
alert("Identificación inválida");
return false;
}
paisOrigen = document.getElementById("PaisOrigen").selectedIndex;
if (paisOrigen == null || paisOrigen == 0) {
alert("País de origen inválido");
return false;
}
provincia = document.getElementById("Provincia").selectedIndex;
if (provincia == null || provincia == 0) {
alert("Provincia inválida");
return false;
}
municipio = document.getElementById("Municipio").selectedIndex;
if (municipio == null || municipio == 0) {
alert("Muninicipio inválido");
return false;
}
// validacion de los campos input tipo "correo"
emailPrimario = document.getElementById("EmailPrimario").value;
if (!/^[^@]+@[^@]+\.[a-zA-Z]{2,}$/.test(emailPrimario)) {
alert("Correo primario inválido");
return false;
}
contraseña = document.getElementById("Contraseña").value;
contraseñaConf = document.getElementById("ContraseñaConf").value;
}