Cambios
This commit is contained in:
@@ -302,12 +302,24 @@
|
||||
e.preventDefault();
|
||||
|
||||
let isValid = true;
|
||||
const inputs = document.querySelectorAll('input.form-control, select.form-select');
|
||||
|
||||
// Validar todos los campos
|
||||
inputs.forEach(input => {
|
||||
if (!input.checkValidity()) {
|
||||
input.classList.add('shake');
|
||||
isValid = false;
|
||||
setTimeout(() => input.classList.remove('shake'), 500);
|
||||
}
|
||||
});
|
||||
|
||||
// Si todo es válido, enviar el formulario
|
||||
if (isValid) {
|
||||
this.submit(); // Esta línea faltaba en tu código original
|
||||
} else {
|
||||
// Mostrar mensaje de error si lo deseas
|
||||
Swal.fire({ title: 'Campos incompletos', text: 'Por favor complete todos los campos requeridos', icon: 'error' });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user