Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/10/2004, 09:27
Avatar de JuanKa
JuanKa
 
Fecha de Ingreso: septiembre-2004
Mensajes: 468
Antigüedad: 19 años, 8 meses
Puntos: 1
No me valida el email

Hola tengo una funcion que no me valida el campo del email... me parece que los la asigancion del valor de la variable cuando entra al if del txt_email no me reconoce.

Primero evaluo si el txt_email esta vacio si es asi asi envio un mensaje y luego ubico el foco en el text caso contrario me valide el CONTENIDO del email.y la expresion regular si esta biennnnn.

que podra ser????????

<html>
<head>
<title></title>
</head>

<SCRIPT>
function valida_informacion(){
with(document.frmInformacion){
if(txt_nomb.value == ""){ // Falta Nombre
alert('¡Por Favor ingrese su Nombre!'); txt_nomb.focus(); return; }

if(txt_email.value == ""){ // Falta E-mail
alert('¡Escriba su Dirección de Correo Electrónico!'); txt_email.focus(); return; }
else {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
alert("La dirección de email " + valor + " es correcta.")
return (true)
} else {
alert("La dirección de email es incorrecta.");
return (false);
}
}

if(txt_tele.value == ""){ // Falta Telefono
alert('¡Ingrese un Teléfono de Referencia!'); txt_tele.focus(); return; }

btnOk.disabled = true;
action="enviar_correo.php";
submit();
}
}
</SCRIPT>

<body bgcolor="#ffffff">
<div align="center"> </div>

<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ECF3FB" class="Middle">
<tr>
<th scope="col"><div align="center">
<div align="center"> </div>
<FORM id=frmInformacion name=frmInformacion action=javascript:valida_informacion(); method=post>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#CCCCCC">
<tr>
<th width="143" height="18" scope="col"><div align="right"><span class="Estilo58">Nombre </span></div></th>
<th width="442" scope="col">
<div align="left">
<input name="txt_nomb" type="text" id="txt_nomb" size="50">
</div></th>
</tr>
<tr>
<th scope="col"><div align="right"><span class="Estilo58">Email </span></div></th>
<th scope="col"><div align="left">
<input name="txt_email" type="text" id="txt_email" size="30"> </div></th>
</tr>
<tr>
<th scope="col"><div align="right"><span class="Estilo58">Tel&eacute;fono</span></div></th>
<th scope="col"><div align="left">
<input name="txt_tele" type="text" id="txt_tele" size="15">
</div></th>
</tr>
</table>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<th scope="col">

<INPUT name="btnOk" type=submit id="btnOk" value="Mandar Solicitud" >
</th>
</tr>
</table>
</form>
</div></th>
</tr>
</table>
</body>
</html>


Gracias y saludos a todos