tengo un formulario en el cual valido que algunos campos que son importantes no se dejen en blanco...bueno me funciona todo bien menos el de una lista desplegable llamada "TIPO ARTEFACTO" porque aunque seleccione un valor.....el script me sigue diciendo que esta vacio...
este es el codigo:
Cita:
lo marcado con azul es la funcion que valida el campo tipo_artefacto<html>
<head>
<title>Ingresar</title>
<script language="javascript">
function validar(form)
{
var error = "POR FAVOR, ANTES DE ENVIAR EL FORMULARIO, DEBE COMPLETAR LOS SIGUIENTES CAMPOS:\n\n";
var a = ""
if (form.csr.value == "") { a += "CSR \n"; }
if (form.loc.value == "") { a += "LOCAL \n"; }
if (form.guia_d.value == "") { a += "GUIA DE DESPACHO\n"; }
if (form.artefacto.value == "") { a += "ARTEFACTO\n"; }
if (form.serie.value == "") { a += "SERIE\n"; }
if (form.tipo_artefacto.value == "") { a += "TIPO ARTEFACTO\n"; }
if (a != "") { alert(error + a); return true; }
form.submit()
}
</script>
<center>
<form name="ingresodist" method="post" action="Scripts/validaingresodis.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 >
<font face="verdana" size="4"><b> <center>Ingreso de Distribuidores </center></b> </font>
</tr></td> </table>
<p><BR>
<a href="menu.asp" TARGET=_parent>
<font face="verdana" size="3" color="BLACK"><B> Volver al Menu</B></font></a><BR>
</p>
<TABLE BORDER=1 bordercolor="#0000FF" CELLSPACING="1" CELLPADDING="5" WIDTH=345>
<tr>
<td width="287" ><b>Csr :</b>
<input type="text" name="csr" id="csr" size=15 MaxLength="8" Value="" onKeyPress="numero('%n',this);">
</td> </tr>
<tr>
<td ><b>Distribuidor :</b> <select name="distribuidor">
<option selected></option>
<option>ABC </option>
<option>DIN </option>
<option>LIDER</option>
<option>DIN_CLIENTE</option>
<option>ABC_CLIENTE</option>
<option>LA_POLAR</option>
<option>FALABELLA</option>
<option>SAN_FRANCISCO</option>
<option>JOHNSONS</option>
<option>SODIMAC</option>
<option>COMERCIAL_GANEM</option>
<option>ALMACENES_PARIS</option>
</select></td> </tr>
<tr>
<td ><b>Local :</b>
<input type="text" name="loc" id="loc" size=20 Value="" onKeyPress="man('%m',this);" >
</td>
</tr>
<tr>
<td ><b>Guia de Despacho :</b>
<input type="text" name="guia_d" id="guia_d" size=15 Value="" onKeyPress="guias('%g',this);">
</td>
</tr>
<tr> <td ><b>Artefacto :</b>
<input type="text" name="artefacto" id="artefacto" size=30 Value="" onKeyPress="guias('%g',this);"></td>
</tr>
<tr> <td ><b>Serie :</b>
<input type="text" name="serie" id="serie" size=15 Value="" onKeyPress="guias('%g',this);"> </td> </tr>
<tr> <td ><b>Tipo Artefacto :</b>
<select name="tipo_artefacto">
<option selected></option>
<option>ALISADOR PELO</option>
<option>ASPIRADORA</option>
<option>BATIDORA</option>
<option>CAFETERA</option>
<option>CALEFONT</option>
<option>CAMPANA COCINA</option>
<option>CENTRIFUGA</option>
<option>COCINA</option>
<option>CUCHILLO ELECTRICO</option>
<option>ENCERADORA</option>
<option>ESTUFA</option>
<option>ESTUFA ELECTRICA</option>
<option>EXTRACTOR JUGO</option>
<option>FREEZER</option>
<option>FREIDORA</option>
<option>H.MICROONDAS</option>
<option>HERVIDOR</option>
<option>HORNO ELECTRICO</option>
<option>LAVADO/SECADO</option>
<option>LICUADORA</option>
<option>LIMPIADOR VAPOR</option>
<option>PARRILLA ELECTRICA</option>
<option>PLANCHA</option>
<option>PROCESADOR ALIMENTOS</option>
<option>RADIADOR OLEOELECTRICO</option>
<option>REFRIGERADOR</option>
<option>SANDWICHERA</option>
<option>SECADOR PELO</option>
<option>TERMOVENTILADOR</option>
<option>TOSTADOR</option>
<option>VENTILADOR</option>
</select></td> </tr>
<tr> <td ><b>Estado :</b>
<select name="estado">
<option selected>REVISION</option>
<option>PXR</option>
<option>SCA</option>
<option>DC</option>
<option>OK</option>
<option>ENTREGADO</option>
</select></td> </tr>
<tr>
<td ><b>Guia de Entrega :</b>
<input type="text" name="guia_sta" id="guia_sta" size=15 Value="" onKeyPress="guias('%g',this);">
</tr>
<tr>
<td ><b>Tipo de Garantía:</b>
<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 ><b>Técnico Asignado :</b>
<select name="tecnico">
<option selected>por asignar</option>
<option>HH</option>
<option>CM</option>
<option>VA</option>
<option>AA</option>
<option>AK</option>
<option>SM</option>
<option>JLV</option>
<option>GP</option>
<option>JD</option>
</select></td> </tr>
<td ><b>Código de Autorización :</b>
<input type="text" name="cod_auto" id="cod_auto" size=15 Value="" >
</tr> </td>
<tr> <td bgcolor><b>Comentarios :</b>
<input type="text" name="comentarios" id="comentarios" size=30 Value="" ></td> </tr>
</table> <br> <br>
<input type="button" value="Terminar" onClick="validar(this.form)">
</tr> </table> </b> </form> </center>
</center>
</body>
</html>
<head>
<title>Ingresar</title>
<script language="javascript">
function validar(form)
{
var error = "POR FAVOR, ANTES DE ENVIAR EL FORMULARIO, DEBE COMPLETAR LOS SIGUIENTES CAMPOS:\n\n";
var a = ""
if (form.csr.value == "") { a += "CSR \n"; }
if (form.loc.value == "") { a += "LOCAL \n"; }
if (form.guia_d.value == "") { a += "GUIA DE DESPACHO\n"; }
if (form.artefacto.value == "") { a += "ARTEFACTO\n"; }
if (form.serie.value == "") { a += "SERIE\n"; }
if (form.tipo_artefacto.value == "") { a += "TIPO ARTEFACTO\n"; }
if (a != "") { alert(error + a); return true; }
form.submit()
}
</script>
<center>
<form name="ingresodist" method="post" action="Scripts/validaingresodis.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 >
<font face="verdana" size="4"><b> <center>Ingreso de Distribuidores </center></b> </font>
</tr></td> </table>
<p><BR>
<a href="menu.asp" TARGET=_parent>
<font face="verdana" size="3" color="BLACK"><B> Volver al Menu</B></font></a><BR>
</p>
<TABLE BORDER=1 bordercolor="#0000FF" CELLSPACING="1" CELLPADDING="5" WIDTH=345>
<tr>
<td width="287" ><b>Csr :</b>
<input type="text" name="csr" id="csr" size=15 MaxLength="8" Value="" onKeyPress="numero('%n',this);">
</td> </tr>
<tr>
<td ><b>Distribuidor :</b> <select name="distribuidor">
<option selected></option>
<option>ABC </option>
<option>DIN </option>
<option>LIDER</option>
<option>DIN_CLIENTE</option>
<option>ABC_CLIENTE</option>
<option>LA_POLAR</option>
<option>FALABELLA</option>
<option>SAN_FRANCISCO</option>
<option>JOHNSONS</option>
<option>SODIMAC</option>
<option>COMERCIAL_GANEM</option>
<option>ALMACENES_PARIS</option>
</select></td> </tr>
<tr>
<td ><b>Local :</b>
<input type="text" name="loc" id="loc" size=20 Value="" onKeyPress="man('%m',this);" >
</td>
</tr>
<tr>
<td ><b>Guia de Despacho :</b>
<input type="text" name="guia_d" id="guia_d" size=15 Value="" onKeyPress="guias('%g',this);">
</td>
</tr>
<tr> <td ><b>Artefacto :</b>
<input type="text" name="artefacto" id="artefacto" size=30 Value="" onKeyPress="guias('%g',this);"></td>
</tr>
<tr> <td ><b>Serie :</b>
<input type="text" name="serie" id="serie" size=15 Value="" onKeyPress="guias('%g',this);"> </td> </tr>
<tr> <td ><b>Tipo Artefacto :</b>
<select name="tipo_artefacto">
<option selected></option>
<option>ALISADOR PELO</option>
<option>ASPIRADORA</option>
<option>BATIDORA</option>
<option>CAFETERA</option>
<option>CALEFONT</option>
<option>CAMPANA COCINA</option>
<option>CENTRIFUGA</option>
<option>COCINA</option>
<option>CUCHILLO ELECTRICO</option>
<option>ENCERADORA</option>
<option>ESTUFA</option>
<option>ESTUFA ELECTRICA</option>
<option>EXTRACTOR JUGO</option>
<option>FREEZER</option>
<option>FREIDORA</option>
<option>H.MICROONDAS</option>
<option>HERVIDOR</option>
<option>HORNO ELECTRICO</option>
<option>LAVADO/SECADO</option>
<option>LICUADORA</option>
<option>LIMPIADOR VAPOR</option>
<option>PARRILLA ELECTRICA</option>
<option>PLANCHA</option>
<option>PROCESADOR ALIMENTOS</option>
<option>RADIADOR OLEOELECTRICO</option>
<option>REFRIGERADOR</option>
<option>SANDWICHERA</option>
<option>SECADOR PELO</option>
<option>TERMOVENTILADOR</option>
<option>TOSTADOR</option>
<option>VENTILADOR</option>
</select></td> </tr>
<tr> <td ><b>Estado :</b>
<select name="estado">
<option selected>REVISION</option>
<option>PXR</option>
<option>SCA</option>
<option>DC</option>
<option>OK</option>
<option>ENTREGADO</option>
</select></td> </tr>
<tr>
<td ><b>Guia de Entrega :</b>
<input type="text" name="guia_sta" id="guia_sta" size=15 Value="" onKeyPress="guias('%g',this);">
</tr>
<tr>
<td ><b>Tipo de Garantía:</b>
<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 ><b>Técnico Asignado :</b>
<select name="tecnico">
<option selected>por asignar</option>
<option>HH</option>
<option>CM</option>
<option>VA</option>
<option>AA</option>
<option>AK</option>
<option>SM</option>
<option>JLV</option>
<option>GP</option>
<option>JD</option>
</select></td> </tr>
<td ><b>Código de Autorización :</b>
<input type="text" name="cod_auto" id="cod_auto" size=15 Value="" >
</tr> </td>
<tr> <td bgcolor><b>Comentarios :</b>
<input type="text" name="comentarios" id="comentarios" size=30 Value="" ></td> </tr>
</table> <br> <br>
<input type="button" value="Terminar" onClick="validar(this.form)">
</tr> </table> </b> </form> </center>
</center>
</body>
</html>
y lo marcado con rojo es el codigo de la lista desplegable
DE ANTEMANO MUCHAS GRACIAS