I have a form, where I have, for example a name field. Then I have a JavaScript
with the following:
function validarNombre() {
valor = document.getElementById("nombre").value;
if (valor == null || valor.length == 0 || /^\s+$/.test(valor)) {
alert('Falta Llenar Nombre');
return false;
} else {
return true;
}
}
Now, in real time, how do I call that function? there is an "out of focus" event (as if the user leaves the text box without completing it) Or do I have to call from the submit
button?
The problem that I have many fields to validate and how is it handled?