Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2012, 10:34
Avatar de JuJoGuAl
JuJoGuAl
 
Fecha de Ingreso: julio-2009
Ubicación: Venezuela
Mensajes: 754
Antigüedad: 14 años, 9 meses
Puntos: 19
Pregunta Insertar campos Dinamicamente

Amigos estoy haciendo un sistema donde tengo que registrar varios registros de medicion, la cuestion es que estos registros pueden ser de 1 a 6 renglones (cada renglon con 5 campos)

entonces me preguntaba de que manera puedo crear un formulario:

Código HTML:
Ver original
  1. <form id="tiempoteform" name="tiempoteform" method="post" action="./index.php?page=medicion_tiempo_te" onSubmit="return  val_tiempo_te(this.id)">
  2.   <div class="form_settings">
  3.         <p><span>Fecha de Medicion:</span>
  4.         <input class="contact" type="text" name="fecha1" id="fecha1" readonly="readonly"/></p>
  5.         <h3>Turno Vespertino 12:00m a 03:00pm </h3>
  6.         <table border="1" cellpadding="0" cellspacing="0">
  7.             <tr>
  8.                 <td colspan="5"><p align="center" class="tabtitulo">Tiempo de entrega</p></td>
  9.             </tr>
  10.           <tr>
  11.             <td><p align="center" class="tabcamp">Nro. Factura</p></td>
  12.             <td><p align="center" class="tabcamp">Montar t&eacute;</p></td>
  13.             <td><p align="center" class="tabcamp">Armado del vaso</p></td>
  14.             <td><p align="center" class="tabcamp">Armado del t&eacute;</p></td>
  15.             <td><p align="center" class="tabcamp">Tiempo total</p></td>
  16.           </tr>
  17.           <tr>
  18.             <td><input type="text" name="tiempotefact1" id="tiempotefact1" onKeyPress="return acceptNum(event)" maxlength="10" size="10" /></td>
  19.             <td><input type="text" name="tiempotemontar1" id="tiempotemontar1" onBlur="calcular('tiempotemontar1','tiempotearmadov1','tiempotearmadot1','tiempototal1',this.id)" onKeyUp="mascara(this,':',patron2,true)" maxlength="6" size="10" /></td>
  20.             <td><input type="text" name="tiempotearmadov1" id="tiempotearmadov1" onBlur="calcular('tiempotemontar1','tiempotearmadov1','tiempotearmadot1','tiempototal1',this.id)" onKeyUp="mascara(this,':',patron2,true)" maxlength="6" size="10" /></td>
  21.             <td><input type="text" name="tiempotearmadot1" id="tiempotearmadot1" onBlur="calcular('tiempotemontar1','tiempotearmadov1','tiempotearmadot1','tiempototal1',this.id)" onKeyUp="mascara(this,':',patron2,true)" maxlength="6" size="10" /></td>
  22.             <td><input name="tiempotetotal1" type="text" id="tiempototal1" readonly="readonly" size="10" /></td>
  23.           </tr>
  24.         </table>
  25.         <h3><input class="submit" type="submit" name="guardar1" value="Registrar"/>
  26.         <input class="submit" name="borrar" type="reset" value="Limpiar Datos"/>
  27.     </h3>
  28. </div>
  29. </form>

y pode añadir mas renglones:

Código HTML:
Ver original
  1. <tr>
  2.             <td><input type="text" name="tiempotefact1" id="tiempotefact1" onKeyPress="return acceptNum(event)" maxlength="10" size="10" /></td>
  3.             <td><input type="text" name="tiempotemontar1" id="tiempotemontar1" onBlur="calcular('tiempotemontar1','tiempotearmadov1','tiempotearmadot1','tiempototal1',this.id)" onKeyUp="mascara(this,':',patron2,true)" maxlength="6" size="10" /></td>
  4.             <td><input type="text" name="tiempotearmadov1" id="tiempotearmadov1" onBlur="calcular('tiempotemontar1','tiempotearmadov1','tiempotearmadot1','tiempototal1',this.id)" onKeyUp="mascara(this,':',patron2,true)" maxlength="6" size="10" /></td>
  5.             <td><input type="text" name="tiempotearmadot1" id="tiempotearmadot1" onBlur="calcular('tiempotemontar1','tiempotearmadov1','tiempotearmadot1','tiempototal1',this.id)" onKeyUp="mascara(this,':',patron2,true)" maxlength="6" size="10" /></td>
  6.             <td><input name="tiempotetotal1" type="text" id="tiempototal1" readonly="readonly" size="10" /></td>
  7.           </tr>

con un + o un boton que diga añadir, y que al momento de guardar solo guarde los renglones activos que tengan datos, de verdad nose como hacerlo :S