Tengo este formulario, el cual intento validar cada campo con javascript, pero no me da ni la hora jajaja, pasa directo de una aunque no ponga nada, xq?????? que puedo hacer o que esta mal? (NO HAGAN CASO A LOS HIDDEN Y ESOS CAMPOS, TIENEN QUE VER CON SALESFORCE)
El JS
Código PHP:
<script type="text/javascript">
function Valida(form) {
if(form.state.value == '') {
alert('Please enter your state');
form.state.focus();
return false;
}
if(form.first_name.value == '') {
alert('Please enter your first name');
form.first_name.focus();
return false;
}
if(form.email.value == '') {
alert('Please enter your email');
form.email.focus();
return false;
}
return true;
}
</script>
Código PHP:
<form action="paginaadondemanda.php" method="POST" class="formheader" name="form" onSubmit="return Valida(this);">
<input type=hidden name="oid" value="00D400000009u8W">
<input type=hidden id="00N40000001IMeh" maxlength="255" name="00N40000001IMeh" size="20" value="www.satbed.com-sign_up_form"/>
<input type=hidden name="retURL" value="http://www.satbed.com/">
<table width="200" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td valign="baseline"><input name="first_name" type="text" class="form1" id="first_name" size="15" maxlength="40" value="Name:" /></td>
<td valign="baseline"><input name="email" type="text" class="form1" id="email" size="20" maxlength="80" value="Email:" /></td>
<td valign="baseline"><input name="state" type="text" class="form1" id="state" style="width:35px" value="State:" size="2" maxlength="2" title="Please insert state here" ></td>
<td valign="baseline" ><input type="image" src="img/boton-form.gif" name="boton_submit" border="0" vspace="0" hspace="5" alt="Enviar" style=" width:19px; position:relative; top:3px; left:2px; display:inline; padding:0; margin:0" /></td>
</tr>
</table>
</form>