enviar datos correctos al responsable
This commit is contained in:
@@ -46,9 +46,9 @@ const caracteresEspeciales = (char) => {
|
||||
return false;
|
||||
};
|
||||
|
||||
const validarTexto = (texto, campo) => {
|
||||
const validarTexto = (texto, campo, length) => {
|
||||
noHay(texto, campo);
|
||||
if (typeof texto !== 'string') noValido(campo);
|
||||
if (typeof texto !== 'string' || texto.length > length) noValido(campo);
|
||||
for (let i = 0; i < texto.length; i++) {
|
||||
if (caracteresEspeciales(texto[i])) continue;
|
||||
if (!validator.isAlpha(texto[i], 'es-ES')) noValido(campo);
|
||||
@@ -56,9 +56,9 @@ const validarTexto = (texto, campo) => {
|
||||
return texto;
|
||||
};
|
||||
|
||||
const validarAlfanumerico = (texto, campo) => {
|
||||
const validarAlfanumerico = (texto, campo, length) => {
|
||||
noHay(texto, campo);
|
||||
if (typeof texto !== 'string') noValido(campo);
|
||||
if (typeof texto !== 'string' || texto.length > length) noValido(campo);
|
||||
for (let i = 0; i < texto.length; i++) {
|
||||
if (caracteresEspeciales(texto[i])) continue;
|
||||
if (!validator.isAlphanumeric(texto[i], 'es-ES')) noValido(campo);
|
||||
|
||||
Reference in New Issue
Block a user