Ver Mensaje Individual
  #3 (permalink)  
Antiguo 19/02/2008, 05:02
frins89
 
Fecha de Ingreso: febrero-2008
Mensajes: 72
Antigüedad: 17 años, 1 mes
Puntos: 0
Re: Ayuda con la campos en blanco

he mirado el link, e intento combinarlo con mi formulario y mi comprobacion, pero no se yo si está bien... dejo el codigo para que lo veais..

<script type="text/javascript">
function trim(cadena)
{
for(i=0; i<cadena.length; )
{
if(cadena.charAt(i)==" ")
cadena=cadena.substring(i+1, cadena.length);
else
break;
}

for(i=cadena.length-1; i>=0; i=cadena.length-1)
{
if(cadena.charAt(i)==" ")
cadena=cadena.substring(0,i);
else
break;
}

forma.caja2.value=cadena;
}


function validarinfor() {
if (document.form1.nick.value==''){
alert("Tienes que poner un Nick.");
return (false);
}
if (document.form1.pass.value==''){
alert("Debes poner un Password.");
return (false);
}
if (document.form1.pass.value!=document.form1.pass1.v alue){
alert("Ambos Password han de ser iguales.");
return (false);
}
document.form1.action ="crear_registro.php";
document.form1.submit();
}



</script>


<form name="form1" method="post" onsubmit="javascript:trim()validarinfor(); return false;">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="200"><strong>Nick</strong></td>
<td><input name="nick" type="text" id="nick"></td>
</tr>
<tr>
<td width="200"><strong>Contrase&ntilde;a</strong></td>
<td><input name="pass" type="password" id="pass">
</tr>
<td width="200"><strong>repite la contraseña</strong></td>
<td><input name="pass1" type="password" id="pass1">
</tr>
<td width="200"><input type="submit" name="Submit" value="Enviar"></td>

</tr>
</table>
</form>