Ir al contenido


Foto

Validar Datos pasados via post en una tabla dinamica


  • Por favor identifícate para responder
2 respuestas en este tema

#1 crinfo

crinfo

    Member

  • Miembros
  • PipPip
  • 26 mensajes

Escrito 20 junio 2014 - 10:49

Estimados, alguien me podria ayudar como validar los datos de una tabla dinamica, le muestro el codigo que encontre.



pero no se me ocurre como poder validar dichos datos.

[html5]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--<script src="Jquery.js" type="text/javascript"></script>-->
<title>Documento sin título</title>
<script>
  var contLin = 3;
function agregar() {
  var tr, td, tabla;

  tabla = document.getElementById('tabla');
  tr = tabla.insertRow(tabla.rows.length);
  td = tr.insertCell(tr.cells.length);
  td.innerHTML = "<input name='button' type=button onclick='agregar()' value='+' >";
  td = tr.insertCell(tr.cells.length);
  td.innerHTML = "<input name='button' type=button onclick='borrarUltima()' value='-' >";
  td = tr.insertCell(tr.cells.length);
  td.innerHTML = "<input type='text' name='almacen"+contLin+"' value='' size='4' >";
  td = tr.insertCell(tr.cells.length);
  td.innerHTML = "<input type='text' value='' name='referencia"+contLin+"' size='10' >";
  td = tr.insertCell(tr.cells.length);
  td.innerHTML = "<input type='text' value='' name='descripcion"+contLin+"' size='30' >";
  td = tr.insertCell(tr.cells.length);
  td.innerHTML = "<input type='text' value=''  name='cantidad"+contLin+"' size='4' >";
  contLin++;
}
function borrarUltima() {
  ultima = document.all.tabla.rows.length - 1;
  if(ultima > -1){
      document.all.tabla.deleteRow(ultima);
      contLin--;
  }
}
    </script>
</head>
<body>
<div class="factura" id="factura">
<form action="post_filas_tablas.php" method="post">
<table id="tabla" border="1">
<tr class="cab_factura">
    <td class="enlace10"></td>
    <td class="enlace10"></td>
    <td class="enlace10">Asignatura</td>
    <td class="enlace10">Seccion</td>
    <td class="enlace10">Horario</td>
    <td class="enlace10">Horas Total Ramos</td>
   
   
  </tr>

<tr>
  <td ><input name="button" type=button onclick="agregar()" value="+" ></td>
  <td ><input name="button" type=button onclick="borrarUltima()" value="-" ></td>
    <td ><input name="almacen2" id="sel1" type="text" size="4"  /></td>
    <td><input name="referencia2" type="text" size="10"  /></td>
    <td><input name="descripcion2" type="text" size="30"  /></td>
    <td><input name="cantidad2" type="text" size="4"  /></td>

 
  </tr>
</table>
<input type="submit" value="datos post"/>
</form>
</body>
</div>
</html>[/html5]

por favor su ayuda...

Saludos
  • 0

#2 crinfo

crinfo

    Member

  • Miembros
  • PipPip
  • 26 mensajes

Escrito 25 junio 2014 - 04:29

gracias por responder
  • 0

#3 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 26 junio 2014 - 08:23

Una pequeña búsqueda en el foro no hace daño de vez en cuando, el siguiente link te puede servir:

http://www.delphiacc...vascript-ayuda/

Saludos.
  • 0




IP.Board spam blocked by CleanTalk.