Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/09/2008, 13:07
Avatar de Quclii
Quclii
 
Fecha de Ingreso: julio-2008
Ubicación: Guadalajara
Mensajes: 76
Antigüedad: 16 años, 7 meses
Puntos: 0
Por que no funcona esta validacion?

tengo un function que se supone no me tiene que dejar que los textbox esten vacios pero el problema esque no hace la funcion le doy al boton de guardar y se envia el formulario en que estoy mal ?


Código:
<HTML>
<style type="text/css">
<!--
.Estilo1 {
	       font-family: "Lucida Console";
	       font-size: 12px;
         }
.Estilo2 {font-size: 12px}
.Estilo3 {font-family: "Lucida Console"}
-->
</style>

   <Script>
   
						 
      <!-- 
            function checkFields(){
                                    missinginfo = "";
                                    if (document.form1.archivo.value == ""){
                                                                             missinginfo += "\n     -  Nombre";
                                                                           }

                                    if (document.form1.numero.value == ""){
                                                                            missinginfo += "\n     -  Nombre";
                                                                          }

                                    if(document.form1.datos.value == ""){
                                                                          missinginfo += "\n     -  Comentarios";
                                                                        }

                                    if (missinginfo != ""){
                                                            missinginfo = "Te ha faltado introducir los siguientes datos:\n" +
                                                            missinginfo + "\n¡Por favor rellena los datos y prueba de nuevo!";
                                                            alert(missinginfo);
                                                            return false;
                                                          }
                                                          else{
														        return true;
                                                              }
								 }
      //-->

     <!--
         var nav4 = window.Event ? true : false;
         function acceptNum(evt){
                                  var key = nav4 ? evt.which : evt.keyCode;	
                                  return (key <= 13 || (key >= 48 && key <= 57));
                                }
     //-->

   </Script>

   <Body>


       <form name="form1" method="post" action="Crear.php">

             <p class="Estilo2"><span class="Estilo3">Nombre Archivo:</span> 
               <input type="text" name="archivo">
             </p>
             <p class="Estilo2 Estilo3">Numero de Datos a Ingresar:
               <input type="text" name="numero" onKeyPress="return acceptNum(event)">
             </p>
	           <p><span class="Estilo1">Ingresar Numeros Enteros:</span> 
               <textarea name="datos" cols="30" onKeyPress="return acceptNum(event)"></textarea>
             </p>
             <p> 
               <input type="submit" value="Guardar" onsubmit="return checkFields();">
             </p>
			 
       </form>

   <form method="post" action="Leer.php">
           
        <p><span class="Estilo2 Estilo3">MODO DE ABRIR EL ARCHIVO</span></p>
        <p>
           <input name="forma" type="radio" value="lectura" checked><span class="Estilo1">LECTURA
           <input name="forma" type="radio" value="modific">MODIFICAR</span>
	    </p>
        <p><span class="Estilo1">Nombre del Archivo:</span> 
           <input type="text" name="abrir">
           <input type="submit" value="Abrir">
        </p>
	 
   </Form>
       
   </Body>

</Html>

Última edición por Quclii; 26/09/2008 a las 15:42