Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/11/2007, 21:22
darkmcloud
 
Fecha de Ingreso: octubre-2007
Mensajes: 191
Antigüedad: 16 años, 7 meses
Puntos: 0
Validar Campos Importantes

Buenas amigos de foros del web......necesito la siguiente ayuda....tengo un formulario el cual deseo que algunos campos sean obligatorios ....
este es el codigo del formulario:

Cita:
<%
if Session("id_usuario") = "" then
Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>"
Response.Write "top.opener.close()"
Response.Write "</SCRIPT>"
Response.Redirect("Login.Asp")
end if
%>
<html>
<head>
<title></title>
</head>
<body bgcolor="#FFCC66" background="2.jpg" text="black" link="black" vlink="black" alink="black">

'funciones para filtrar teclas, mayusculas, minusculas y numeros
<script language="javascript">



function nombre1(cadena,obj)
{
opc=false;
if (cadena='%n')
{if (event.keyCode>96 && event.keyCode<123)
opc=true;
}

if (cadena =="%n")
{ if (event.keyCode>64 && event.keyCode <89)
opc=true;
}

if (cadena =="%n")
{ if (event.keyCode>31 && event.keyCode <33)
opc=true;
}
if(opc==false)
{
event.returnValue=false;
}
}

function numero(cadena,obj)
{
opc=false;
if (cadena='%n')
{if (event.keyCode>47 && event.keyCode<58)
opc=true;
}

if(opc==false)
{
event.returnValue=false;
}
}

function guias(cadena,obj)
{
opc=false;
if (cadena =="%g")
{if (event.keyCode>47 && event.keyCode<58)
opc=true;
}

if (cadena='%g')
{if (event.keyCode>44 && event.keyCode<46)
opc=true;
}
if (cadena='%g')
{if (event.keyCode>96 && event.keyCode<123)
opc=true;
}

if (cadena =="%g")
{ if (event.keyCode>64 && event.keyCode <89)
opc=true;
}

if (cadena =="%g")
{ if (event.keyCode>31 && event.keyCode <33)
opc=true;
}

if(opc==false)
{
event.returnValue=false;
}
}

</script>

<form name="ingreclie" method="post" action="Scripts/ingresar.asp">
<b><font color="white" size="6" face="verdana">CONTROL TALLER 2.0 </font></b>
<hr size=1>
<TABLE BORDER=1 bordercolor="#0000FF" CELLSPACING="1" CELLPADDING="5" WIDTH=250>
<tr> <td width=285 bgcolor="#FFCC66">
<font face="verdana" size="4"><b> <center>
Ingreso de Distribuidores
</center></b> </font>
</tr> </table><BR>

<a href="menu.asp" TARGET=_parent>
<font face="verdana" size="3" color="BLACK"><B> Volver al Menu </B></font> </a>
</center>

<BR>
<TABLE BORDER=1 bordercolor="#0000FF" CELLSPACING="1" CELLPADDING="5" WIDTH=402>

<tr>
<td width="386" bgcolor="#FFCC66"><b>Csr :</b>&nbsp; &nbsp;&nbsp; &nbsp;
<input type="text" name="csr" id="csr" size=15 Value="" onKeyPress="numero('%n',this);">
<tr>
<td bgcolor="#FFCC66"><b>Local :</b>&nbsp;&nbsp;&nbsp;
<input type="text" name="loc" id="loc" size=20 Value="" onKeyPress="nombre1('%n',this);">
</tr>
<tr>
<td bgcolor="#FFCC66"><b>Guia de Despacho :</b>&nbsp;&nbsp;&nbsp;
<input type="text" name="guia_d" id="guia_d" size=15 Value="" onKeyPress="guias('%g',this);">
</tr>
<tr>
<td bgcolor="#FFCC66"><b>Distribuidor :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
<select name="distribuidor">
<option selected></option>
<option>ABC STOCK</option>
<option>DIN STOCK</option>
<option>TODO LIDER</option>
<option>DIN CLIENTE</option>
<option>ABC CLIENTE</option>
<option>LA POLAR</option>
<option>FALABELLA</option>
<option>SAN FRANCISCO</option>
<option>JOHNSON'S</option>
<option>SODIMAC</option>
<option>COMERCIAL GANEM</option>
<option>ALMACENES PARIS</option>

</select></td> </tr>


<tr> <td bgcolor="#FFCC66"><b>Artefacto :</b>&nbsp;&nbsp;&nbsp;
<input type="text" name="artefacto" id="artefacto" size=30 Value="" onKeyPress="guias('%g',this);"></td>
<tr> <td bgcolor="#FFCC66"><b>Serie :</b>&nbsp;&nbsp;
<input type="text" name="serie" id="serie" size=15 Value="" onKeyPress="guias('%g',this);"> </td> </tr>
<tr> <td bgcolor="#FFCC66"><b>Estado :</b>&nbsp;
<select name="estado">
<option selected>REVISION</option>
<option>PXR</option>
<option>SCA</option>
<option>DC</option>
<option>OK</option>
<option>ENTREGADO</option>
<option>ENPROCESO</option>
</select></td> </tr>



<tr>
<td bgcolor="#FFCC66"><b>Guia de Entrega :</b>&nbsp;&nbsp;&nbsp;
<input type="text" name="guia_sta" id="guia_sta" size=15 Value="" onKeyPress="guias('%g',this);">
</tr>
<tr>
<td bgcolor="#FFCC66"><b>Tipo de Garantía:</b>&nbsp;&nbsp;&nbsp;
<select name="gtia">
<option selected>DG</option>
<option>FG</option>
<option>GE</option>
<option>GTIA TALLER</option>
<option>ENPROCESO</option>
</select></td> </tr>

<tr>
<td bgcolor="#FFCC66"><b>Técnico Asignado :</b>&nbsp;&nbsp;&nbsp;
<select name="tecnico">
<option selected>por asignar</option>
<option>Hernan Herrera</option>
<option>Carlos Mora</option>
<option>Victor Astorga</option>
<option>Antonio Arancibia</option>
<option>Alexis Kuhnert</option>
<option>Sebastian Molina</option>
<option>Jose Luis Vera</option>
<option>Guillermo Pinto</option>
</select></td> </tr>

<td bgcolor="#FFCC66"><b>Código de Autorización :</b>&nbsp;&nbsp;&nbsp;
<input type="text" name="cod_auto" id="cod_auto" size=15 Value="" onKeyPress="guias('%g',this);">
</tr>

</table> <br> <br>
<input id=submit1 type=submit value=Aceptar name=submit1>
<input type="RESET" VALUE="Limpiar Formulario">
</tr> </table> </b> </form> </center>

<hr size=1> <center> <b> <i> <font face="Verdana" color="BLACK">
<%response.write(date())%>
<br>
<%response.write(time())%>
</font> </i> </b> </center>
</body>
</html>
en el tengo el evento onKeyPress para filtrar solo numeros, solo mayusculas, solo minusculas, etc......entonces la idea mia es que los campos csr, local, artefacto y serie sean obligatorios....y si falta alguno no deje enviar el formulario....

De antemano muchas gracias