Ver Mensaje Individual
  #6 (permalink)  
Antiguo 11/08/2008, 12:27
SoftEdward
 
Fecha de Ingreso: febrero-2005
Ubicación: 101% Paraguayo
Mensajes: 57
Antigüedad: 19 años, 3 meses
Puntos: 0
Respuesta: Como puedo validar esto?

No se si es la solucion que buscabas... quizas te sirva en parte.. no se si entendi bien tu consulta.
Solo consulta.
Espero te sirva.

Saludos

Código HTML:
<script>
function revisar(){
 try{
	existe = 0;
	tarjetaTipo = null;
	for (i=0; i < document.form.length; i++){
		if (document.form.elements[i].type=="checkbox"){
			if (document.form.elements[i].checked){
				tarjetaTipo=(document.form.elements[i].value);
				existe=existe+1;
			}
		}
	}
	
	if(existe==0){
		alert("DEBE SELECCIONAR ALMENOS 1");
		return false;
	}else{
		Err="";
		for (i=0; i < document.form.length; i++){
			if (document.form.elements[i].type=="checkbox"){
				if (document.form.elements[i].checked){
					if((document.form.elements[i].value)<=0){
						Err = Err+"Valor menores a 0 en la seleccion siguiente: "+document.form.elements[i].value+"\n";
						//a=a+1
					}
				}
			}
		}
		if (Err!=""){
			alert("Error en los siguientes campos: \n"+ Err);
			return false;
		}
	}

 }catch(e){
 	alert("Error: "+e);
 }
}
</script>

<form action="" method="post" name="form" id="form" onsubmit="return revisar()">
  <table width=50% border=1 cellpadding=2 cellspacing=0 align=center>
    <tr>
      <td width=10% align=center><b>Item</b></td>
      <td width=70% align=center><b>Documentos</b></td>
      <td width=20% align=center><b>Bultos</b></td>
    </tr>
    <tr>
      <td width=10% align=center valign="top">1</td>
      <td width=70% align=center>
        <input name=docto type="checkbox" value=014215015 />4215015<br />
        <input name=docto type="checkbox" value=014215016 />4215016<br />
        <input name=docto type="checkbox" value=014215017 />4215017<br />
      </td>
      <td width=20% align=center valign="top"><input name="bulto" type="text" size="4" maxlength="4" /></td>
    </tr>
    <tr>
      <td width=10% align=center valign="top">2</td>
      <td width=70% align=center>
          <input name=docto type="checkbox" value=024215018 />4215018<br />
          <input name=docto type="checkbox" value=024215019 />4215019<br />
      </td>
      <td width=20% align=center valign="top"><input name="bulto" type="text" size="4" maxlength="4" /></td>
    </tr>
    <tr>
      <td width=10% align=center valign="top">3</td>
      <td width=70% align=center>
        <input name=docto type="checkbox" value=039919344 />9919344<br />
        <input name=docto type="checkbox" value=039919345 />9919345<br />
        <input name=docto type="checkbox" value=039919346 />9919346<br />
        <input name=docto type="checkbox" value=039919347 />9919347<br />
        <input name=docto type="checkbox" value=039919348 />9919348<br />
        <input name=docto type="checkbox" value=0 />0<br />
      </td>
      <td width=20% align=center valign="top"><input name="bulto" type="text" size="4" maxlength="4" /></td>
    </tr>
  </table>
  <div align="center">
    <input name="enviar" type="submit" value="Enviar"/>
  </div>
</form> 

Última edición por SoftEdward; 11/08/2008 a las 12:31 Razón: Ajustar