Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/04/2007, 11:12
mary*
 
Fecha de Ingreso: septiembre-2006
Mensajes: 161
Antigüedad: 18 años, 4 meses
Puntos: 0
Pregunta No enviar datos hasta que el formulario este lleno???

Hola a todos!!!

Regreso con una nueva duda...Tengo una pagina en la cual se envían datos a una BD a través de un formulario...como hago para que si un campo del formulario esta vacio no envie nada hasta que todos esten llenos???...En que parte del código coloco esta condicion y como??

Le dejo mi codigo y gracias por la ayuda!!!

Código:
<%
	<%
	'ESTOS REQUEST.FORM SON LOS NOMBRES DE LOS CAMPOS DE FORM DE LA PAGINA ACTUAL
	if (Request.querystring("cia")) and (Request.querystring("vendedor")) and (Request.querystring("descrip")) and isdate(Request.Form("fecha_v")) and (Request.querystring("contacto")) and (Request.querystring("tel")) and (Request.querystring("comentario")) then 
	Response.Redirect "Cap3.asp"
	end if

	vcia= (Request.Form("cia"))
	vvend= (Request.Form("vendedor"))
	vdesc= (Request.Form("descrip"))
	vfechv= (Request.Form("fecha_v"))
	vcont= (Request.Form("contacto"))
	vtel= (Request.Form("tel"))
	vcom= (Request.Form("comentario"))	
	
	'Conección con la BD
	sConnStr = "Driver={SQL Server};Server=MGU;Database=Ventas;UID=sa;Password=sa;"
	Set objConn = Server.CreateObject("ADODB.Connection") 
	objConn.Open sConnStr
	
 '*** INSERTAR DATOS ***	
	'Ligamos la tabla temporal a la vista de la BD
	strSQL_N = "INSERT INTO CLIENTES_POR_CONT (CIA, VENDEDOR, DESCRIP, FECHA_VIST, CONTACTO, TEL, COMENTARIO) VALUES ('" & vcia & "', '" & vvend & "' , '" & vdesc & "' , '" & vfechv & "' , '" & vcont & "' , '" & vtel & "' , '" & vcom & "')"
	Set RS = objConn.execute(strSQL_N)
%>

<html>
<head>
<title>SCI VENTAS : Captuta de Cientes por Contactar</title>
<style type="text/css">
<!--
.Estilo24 {font-family: "Times New Roman", Times, serif; font-weight: bold; }
.Estilo4 {font-family: "Times New Roman", Times, serif}
body {
	background-color: #F4F4F4;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<p align="left"><font face="Verdana"><strong>Clientes por Contactar</strong></font></p>
<form method="POST" action="Cons3.asp">
  <table width="100%" border="2" bordercolor="#008000" bgcolor="#CCFFCC">
    <tr>
      <td><table width="100%" border="0" bgcolor="#CCFFCC">
          <tr bgcolor="#008000">
            <td height="35" colspan="2"><div align="center"><font color="#FFFFFF">Capturar Datos</font></div></td>
          </tr>
          <tr>
            <td>COMPA&Ntilde;IA : </td>
            <td><p align="left">
                <input type="text" name="cia" size="100">
            </td>
          </tr>
          <tr>
            <td>VENDEDOR : </td>
            <td><p align="left">
                <input type="text" name="vendedor" size="100">
            </td>
          </tr>
          <tr>
            <td>DESCRIPCION:</td>
            <td><input type="text" name="descrip" size="100"></td>
          </tr>
          <tr>
            <td>FECHA VISITA :</td>
            <td><p align="left">
                <input type="text" name="fecha_v" size="100">
            </td>
          </tr>
          <tr>
            <td>CONTACTO : </td>
            <td><p align="left">
                <input type="text" name="contacto" size="100">
            </td>
          </tr>
          <tr>
            <td>TELEFONO :</td>
            <td><input type="text" name="tel" size="100"></td>
          </tr>
          <tr>
            <td width="42%">COMENTARIO: </td>
            <td width="58%"><p align="left">
                <input type="text" name="comentario" size="100">
            </p></td>
          </tr>
      </table></td>
    </tr>
  </table>
  <p>
    <input type="submit" value="Enviar" name="B1"> 
    <input type="reset" value="Restablecer" name="B2">
  </p>
    </p>
</form>
</body>
</html>