YO TENGO LO SIGUIENTE
UN BOTON ME INSERTA VARIOS CAMPOS, Y OTRO BOTON ME CREA TABLAS PERO CON UN SOLO NOMBRE.
LISTO EN LAS TABLAS SE MUESTRAN UNAS LISTAS DESPLEGABLES QUE TAMBIEN SON DINAMICAS, PERO ESTAS TABLAS CON ESTAS LISTAS SOLO ME APARECEN EN UN CAMPO ES DECIR EJEMPLO
INSERTO 2 FILAS DE CAMPOS Y QUIERO INSERTAR EN CADA FILA UNA TABLA , ENTONCES LE DOY EN OTRO BOTON Y ME INSERTA LA TABLA PERO SOLO EN LA PRIMERA FILA, Y NECESITARIA UNA POR FILA
ESTO ES LO QUE TENGO DE CODIGO!!
ESTA ES LA FUNCION QUE ME CREA LOS CAMPOS DINAMICOS
Código Javascript:
Ver original
var posicionCampo=1; var posicionCampoMedio=1; var posicionCampoLote=1; function agregarUsuario(){ nuevaFila = document.getElementById("tabla").insertRow(-1); nuevaFila.id=posicionCampo; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td><input type='text' size='12' name='Anali["+posicionCampo+"]' ></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='30' id='Produc"+posicionCampo+"' name='Produc["+posicionCampo+"]' onkeypress='return soloLetras(event)'></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='9' id='Lot"+posicionCampo+"' name='Lot["+posicionCampo+"]' value='' onkeypress='return soloLetras(event)'></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='15' id='Presen"+posicionCampo+"' name='Presen["+posicionCampo+"]' ></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='20' id='Clien"+posicionCampo+"' name='Clien["+posicionCampo+"]' value=''></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='8' name='Canti["+posicionCampo+"]' value=''></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='20' id='For"+posicionCampo+"' name='For["+posicionCampo+"]' value=''></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input size='10' id='fc_1348595831' type='text' name='FechaRec["+posicionCampo+"]' title='YYMMDD' onClick='displayCalendar(this);'></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input size='10' id='fc_1348596085' type='text' name='FechaAn["+posicionCampo+"]' title='YYMMDD' onClick='displayCalendar(this);'></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td><input size='10' id='fc_1348596150' type='text' name='FechaRes["+posicionCampo+"]' title='YYMMDD' onClick='displayCalendar(this);'></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td><table name='medios["+posicionCampo+"]' id='medios"+posicionCampo+"'></table></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td><table name='lote["+posicionCampo+"]' id='lote'></table></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='8' id='Tec"+posicionCampo+"' name='Tec["+posicionCampo+"]' value='USP 35'></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='18' id='Meto"+posicionCampo+"' name='Meto["+posicionCampo+"]' value=''></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td> <input type='text' size='18' id='Formato"+posicionCampo+"' name='Formato["+posicionCampo+"]' value=''></td>"; nuevaCelda=nuevaFila.insertCell(-1); nuevaCelda.innerHTML="<td><input type='button' value='Eliminar' onclick='eliminarUsuario(this)'></td>"; posicionCampo++; }
ESTA ES LA FUNCION QUE ME CREA LAS TABLAS DENTRO DE LOS CAMPOS
Código Javascript:
Ver original
function agregarmedios(){ nuevaCampo = document.getElementById('medios"+posicionCampo+"').insertRow(-1); nuevaCampo2 = document.getElementById('lote').insertRow(-1); nuevaCampo.id=posicionCampoMedio; nuevaCampo2.id=posicionCampoLote; nuevalista=nuevaCampo.insertCell(-1); nuevalista.innerHTML="<td><select name='nombre["+posicionCampoMedio+"]'><option value='0'>Medios</option><option value='AGAR CASOY (Mesofilos aerobios)'>AGAR CASOY (Mesofilos aerobios)</option><option value='AGAR CETRIMIDE (Pseudomonas sp)'>AGAR CETRIMIDE (Pseudomonas aeruginosa)</option><option value='AGAR CHROMOCULT (Coliformes totales)'>AGAR CHROMOCULT (Coliformes totales)</option><option value='AGAR COLUMBIA (Clostridum sporogenes)'>AGAR COLUMBIA (Clostridum sporogenes)</option><option value='AGAR MacConkey (E. coli)'>AGAR MacConkey (E. coli)</option><option value='AGAR PLATE COUNT (Mesofilos aerobios)'>AGAR PLATE COUNT (Mesofilos aerobios)</option><option value='AGAR SABOURAUD (Candida albicans)'>AGAR SABOURAUD (Candida albicans)</option><option value='AGAR SABOURAUD (Hongos y levaduras)'>AGAR SABOURAUD (Hongos y levaduras)</option><option value='AGAR SALADO MANITOL (Staphylococcus aureus)'>AGAR SALADO MANITOL (Staphylococcus aureus)</option><option value='AGAR VRB (Coliformes)'>AGAR VRB (Coliformes)</option><option value='AGAR VRB (Enterobacterias)'>AGAR VRB (Enterobacterias)</option><option value='AGAR XLD (Salmonella sp)'>AGAR XLD (Salmonella sp)</option><option value='CALDO BRILLA 2 % (Coliformes fecales)'>CALDO BRILLA 2 % (Coliformes fecales)</option><option value='CALDO BRILLA 2 % (Coliformes totales)'>CALDO BRILLA 2 % (Coliformes totales)</option></select></td>"; nuevalista=nuevaCampo.insertCell(-1); nuevalista.innerHTML="<td><input type='button' value='x' onclick='eliminarcampo(this)'></td>"; nuevalote=nuevaCampo2.insertCell(-1); nuevalote.innerHTML="<td><input type='text' size='8' name='lotes"+posicionCampoLote+"' id='lotes["+posicionCampoLote+"]' value=''></td>"; nuevalote=nuevaCampo2.insertCell(-1); nuevalote.innerHTML="<td><input type='button' value='x' onclick='eliminarcampo(this)'></td>"; posicionCampoMedio++; posicionCampoLote++; }
Y ESTO ES LO DEL FORMULARIO
Código PHP:
Ver original
<form id="form1" name="form1" method="post" action="operaciones.php"> <input name="Agregar" type="button" value="Filas" onClick="agregarUsuario()"> <input name="AgregarMedios" type="button" value="Medios" onClick="agregarmedios()"> <table width="236%" border="1" id="tabla"> <tr> <th width="7%" scope="col">No.Analisis</th> <th width="7%" scope="col">Producto</th> <th width="7%" scope="col">Lote</th> <th width="7%" scope="col">Presentacion</th> <th width="7%" scope="col">Cliente</th> <th width="7%" scope="col">Cantidad Muestreada</th> <th width="7%" scope="col">Forma Farmaceutica</th> <th width="7%" scope="col"><p>Fecha Recepcion</p></th> <th width="7%" scope="col"><p>Fecha Analisis</p></th> <th width="7%" scope="col"><p>Fecha Resultados</p></th> <th width="12%" scope="col">Medios Cultivo</th> <th width="7%" scope="col">N.Lote Medios </th> <th width="3%" scope="col">Tecnica</th> <th width="3%" scope="col">Metodo</th> <th width="3%" scope="col">Formato</th> </tr> </table></br> <input name="enviar" type="submit" value="ENVIAR" />
GRACIAS POR TODA LA AYUDA QUE ME PUEDAN BRINDAR