Resulta que tengo un formulario normal de registro, pero antes de enviarlo tengo dos botones para validar un código de usuario y cuando ejecuto estos botones, directamente ejecuta el formulario sin antes validar el codigo indicado.
Este es mi codigo:
Cita:
Como se ve deseo ejecutar los botones "OBTENER CODIGO y luego VALIDAR pero sin que el formulario envié los datos, y enviar recién los datos cuando le doy al botón suscribirte. <form method="post" class="af-form-wrapper" accept-charset="UTF-8" action="https://www.aweber.com/scripts/addlead.pl" >
<div style="display: none;">
<input type="hidden" name="meta_web_form_id" value="1924685160" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="awlist4348699" />
<input type="hidden" name="redirect" value="http://nivel10.org/registro/agradecimiento.php" id="redirect_64b331ce9dcf232fe2698e2885c2798b" />
<input type="hidden" name="meta_adtracking" value="Nivel10_compro_kilos" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email,custom Whatsapp" />
<input type="hidden" name="meta_tooltip" value="name||Nombre,,email||Email,,custom Whatsapp||+591 XXXXXXX" />
</div>
<table align="center">
<tr>
<td><input type="text" name="name" class="text" value="Ingresa tu Nombre" onfocus=" if (this.value == 'Ingresa tu Nombre') { this.value = ''; }" onblur="if (this.value == '') { this.value='Ingresa tu Nombre';} " tabindex="700" size="45" style="color:#333;height:40px;font-size:20px;padding-left:20px"/></td>
</tr>
<tr>
<td><input type="text" name="email" value="Ingresa tu Mail" onfocus=" if (this.value == 'Ingresa tu Mail') { this.value = ''; }" onblur="if (this.value == '') { this.value='Ingresa tu Mail';} " tabindex="700" size="45" height="30" style="color:#333;height:40px;font-size:20px;padding-left:20px"/></td>
</tr>
<tr>
<td><input type="text" name="custom Whatsapp" value="Ingresa tu Numero de Whatsapp" onfocus=" if (this.value == 'Ingresa tu Numero de Whatsapp') { this.value = ''; }" onblur="if (this.value == '') { this.value='Ingresa tu Numero de Whatsapp';} " tabindex="700" size="45" height="30" style="color:#333;height:40px;font-size:20px;padding-left:20px"/></td>
</tr>
<tr>
<td><label for="inputID">ID:</label>
<input type="text" id="inputID">
<button id="obtenerCodigo" >Obtener Código</button>
<button id="validar" >Validar</button>
<h3 id="resultado"></h3><br />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="image" value="Enviar Datos" src="http://nivel10.org/registro/imagenes/boton-subscribete.png"/></td>
</tr>
</table>
</form>
<div style="display: none;">
<input type="hidden" name="meta_web_form_id" value="1924685160" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="awlist4348699" />
<input type="hidden" name="redirect" value="http://nivel10.org/registro/agradecimiento.php" id="redirect_64b331ce9dcf232fe2698e2885c2798b" />
<input type="hidden" name="meta_adtracking" value="Nivel10_compro_kilos" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email,custom Whatsapp" />
<input type="hidden" name="meta_tooltip" value="name||Nombre,,email||Email,,custom Whatsapp||+591 XXXXXXX" />
</div>
<table align="center">
<tr>
<td><input type="text" name="name" class="text" value="Ingresa tu Nombre" onfocus=" if (this.value == 'Ingresa tu Nombre') { this.value = ''; }" onblur="if (this.value == '') { this.value='Ingresa tu Nombre';} " tabindex="700" size="45" style="color:#333;height:40px;font-size:20px;padding-left:20px"/></td>
</tr>
<tr>
<td><input type="text" name="email" value="Ingresa tu Mail" onfocus=" if (this.value == 'Ingresa tu Mail') { this.value = ''; }" onblur="if (this.value == '') { this.value='Ingresa tu Mail';} " tabindex="700" size="45" height="30" style="color:#333;height:40px;font-size:20px;padding-left:20px"/></td>
</tr>
<tr>
<td><input type="text" name="custom Whatsapp" value="Ingresa tu Numero de Whatsapp" onfocus=" if (this.value == 'Ingresa tu Numero de Whatsapp') { this.value = ''; }" onblur="if (this.value == '') { this.value='Ingresa tu Numero de Whatsapp';} " tabindex="700" size="45" height="30" style="color:#333;height:40px;font-size:20px;padding-left:20px"/></td>
</tr>
<tr>
<td><label for="inputID">ID:</label>
<input type="text" id="inputID">
<button id="obtenerCodigo" >Obtener Código</button>
<button id="validar" >Validar</button>
<h3 id="resultado"></h3><br />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="image" value="Enviar Datos" src="http://nivel10.org/registro/imagenes/boton-subscribete.png"/></td>
</tr>
</table>
</form>
Espero que se haya entendido y que también pueda haber una solución
Muchas gracias!!