Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/12/2009, 09:39
[email protected]
 
Fecha de Ingreso: octubre-2005
Mensajes: 405
Antigüedad: 19 años, 4 meses
Puntos: 1
validar input text []

¿Como puedo validar que campo cant[], correspondiente a la cantidad en formulario siempre vaya con valor?


Código PHP:
<?                                                                              
 
require("../aut_verifica.inc.php");                                            
 include(
"config.php");                                                         
?>                                                                              
<html>                                                                          
 <head>                                                                         
  <title>Cantidades Pedidas</title>                                             
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">      
  <script>                                                                      
    function ValidaCantidad(f)                                                  
    {                                                                           
                                                                                
    }                                                                           
  </script>                                                                     
 </head>                                                                        
 <body>   
<form action="index.php?pagina=vi-so-resave" name="form1" method="post" OnSubmit="return ValidaCantidad(this);">                                              
 <table  id=tabla-style1 border=0 cellpadding=1 cellspacing=1>       
  <tr>                                                               
   <th>Item</th>                                                     
   <th>C&oacute;digo</th>                                            
   <th>Descripci&oacute;n</th>                                       
   <th>Cantidad</th>                                                 
   <th>Opciones</th>                                                 
  </tr>
  $sqls=mysql_query("select * from SOLICITUD where FOLIO_S=0 and MARCA_S = 'P' and LOCAL_S = '$_SESSION[usuario_local]'") or die("Problemas con conexion..<b>".mysql_error()."</b>");                                                           
  $numeroRegistross=mysql_num_rows($sqls);                                      
  if($numeroRegistross > 0)                                                     
  {                                                                             
       $item=1;                                                                 
       while($filas=mysql_fetch_array($sqls))                                   
       {                                                                        
          $id=$filas['ID_S'];                                                   
          $cod=$filas['CODIGO_S'];                                              
          $sqlp=mysql_query("select NOMBRE_P from EXIPRO where CODPRO_P = '$cod'") or die("Problemas de Conexion Productos..<b>".mysql_error()."</b>");         
          $nombre=mysql_fetch_array($sqlp);                                     
          $nom=$nombre['NOMBRE_P'];                                             
          echo"                                                                 
          <tr>                                                                  
              <td>$item</td>                                                    
              <td>$cod</td>                                                     
              <td>$nom</td>                                                     
              <td class=center>                                                 
                 <input type=hidden name='id[]' value=$id>                      
                 <input type=hidden name='codigo[]' value=$cod>                 
                 <input type=text id='canti' name='cant[]' size=5 maxlength=3>  
              </td>                                                             
              <td class=opciones-tab>                                           
                <a href='index.php?pagina=vi-so-delete&idelim=$id' onclick=\"ret
urn confirm('Esta seguro de eliminar producto $cod del pedido.')\"><img src='../
img/delete.png' title='Eliminar Productos'></a>                                 
              </td>                                                             
             </tr>";                                                            
             $item=$item+1;                                                     
        }                                                                       
        echo"<tr><td colspan=5><input type=submit name='submit' id='procesar' va
lue='Guardar Pedido'></td></tr>";                                               
   }                                                                            
   else                                                                         
   {                                                                            
       echo "<tr><td colspan=5 align=center>No exiten productos pendientes</td></tr>";                                                                          
   }                                                                            
?>          
 </table>   
 </form>    
 </body>      
</html>