Dear,
I am making a normal form with name, rut and last name.
I am sending the form with a button, but when the data is not validated the same form is sent. so my question is.
Is there a javaScript function that stops the button submit to fail the validation?.
function sendForm(){
alert("ENTRO SEND");
alert("valido: "+valido);
if(valido){
alert("valido TRUE");
validateSetDataAhorro();
}else{
alert("valido FALSE");
return false;
}
}
<form action="http://algunsitio.com/prog/usuarionuevo" method="post">
<p>
<label for="nombre">Nombre: </label>
<input type="text" id="nombre"><br/>
<label for="apellido">Apellido: </label>
<INPUT type="text" id="apellido"><br/>
<label for="email">Rut: </label>
<INPUT type="text" id="email"><br/>
<button onclick="javascript:sendForm();" class="btn btn-second"
title="Continuar">Boton</button>
</p>
</form>