LOGIN
Reg&iuacute;strateLinksForosPrivadosPrivadosContacta
 
FOROS > Programación
<< < [6] 7 >    Crear los campos de un formulario dinámicamente con javascr ...
08/01/2009    16:04


Registrado: 14/04/2004
Nº mensajes: 491

  Living QuotePrivado  
 
Hola Maderik, siento la tardanza pero con las navidades encima no he podido visitar el foro.
Si te he entendido bien creo que quieres que se muestren los datos que ya habías metido previamente, si es eso un usuario ya hizo una pregunta como la tuya y la solución la encontrás más abajo

/foro/showThread.php?id=1435&desde=10#msg1523

Selena, te agradecería mucho si pusieras todo el código, no solamente la función. Así me es más sencillo ver el error.

Bienvenidos a los dos!!
 
 

El mayor placer de un hombre inteligente es aparentar ser idiota, delante de un idiota que aparenta ser inteligente.



 
09/01/2009    00:05


Registrado: 04/01/2009
Nº mensajes: 5

  Selena QuotePrivado  
 

Hola Living he modificado tu codigo inicial para cuplir mis necesidades pero tengo problemas como uno nuestro amigo, revise bien ademas veras que he tratado de hacer la conexion con la base de dato´para llamar el codigo, nombre, precio  aqui te envio el codigo  espero que me puedas ayudar.

<?php
$link = mysql_connect("localhost", "root","");
mysql_select_db("bd", $link);

function mostrarProductos () {
    while ($res = mysql_fetch_array($c)) {
     $select = "<option value ='".$res['codigop']."'>".$res['codigo'] ."</option>";
    }
    return $select;
 }
 $c = mysql_query ('select * from Producto where codigop='$codigo'') or die(mysql_error());
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ejemplo formulario</title>

<script language="javascript" type="text/javascript">
var indiceFilaFormulario=1;
function addPerson(){
 myNewRow = document.getElementById("tablaFormulario").insertRow(-1);
 myNewRow.id=indiceFilaFormulario;
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td> <input size='10' type='text' name='codigo["+indiceFilaFormulario+"]' <? mostrarProductos(); ?> ></td>";
 
  myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td> <input size='20' type='text' name='nombre["+indiceFilaFormulario+"]' ></td>";
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input size='6' type='text' name='cant["+indiceFilaFormulario+"]' id='cant"+indiceFilaFormulario+"' onKeyUp='fncActualizar("+indiceFilaFormulario+")'</td>";
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input size='7'  type='text' name='precio["+indiceFilaFormulario+"]' id='precio"+indiceFilaFormulario+"' onKeyUp='fncActualizar("+indiceFilaFormulario+")'</td>";
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input  size='10' type='text' name='sub["+indiceFilaFormulario+"]'  id='sub"+indiceFilaFormulario+"' value='0'> </td>";
 
  myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input class='red' type='button' value='-' onclick='removePerson(this)'  ></td>";
 indiceFilaFormulario++;
 
}
function removePerson(obj){
 var oTr = obj;
 while(oTr.nodeName.toLowerCase()!='tr'){
  oTr=oTr.parentNode;
 }
 var root = oTr.parentNode;
 root.removeChild(oTr);
}

var total;
function fncActualizar(indiceFilaFormulario)
{
var sub = document.getElementById("sub"+indiceFilaFormulario);
var precio = document.getElementById("precio"+indiceFilaFormulario);
var cant = document.getElementById("cant"+indiceFilaFormulario);
var total = document.getElementById("sub");
var subt=0;
  for(i=4;i<indiceFilaFormulario.length;i++){
   for (j=4;j=indiceFilaFormulario.length;j++){
    sub.value = precio.value  *  cant.value;
    subt+=sub.value;
   }}
   for(i=1;i<indiceFilaFormulario.length;i++){
    total.value+=subt.value;
   }
};
</script>
</head>
<body>
 <form action="formu.php" name="formulario" method="post">
<table width="603" align="center" cellpadding="0" cellspacing="0" >
      <tr>
        <td colspan="3" align="center">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">
 <table width="600" align="center" cellpadding='3' cellspacing='3' bgcolor="#91E3FB" id="tablaFormulario" style="border:#CBDDEB">
            <tr bgColor='#95C6F7'>
              <td width="69"><div align="center"><strong>Codigo </strong></div></td>
              <td width="147"><div align="center"><strong>Nombre</strong></div></td>
              <td width="87"><div align="center"><strong>Precio</strong></div></td>
     <td width="85"><div align="center"><strong>Cantidad</strong></div></td>
      <td width="89"><div align="center"><strong>Sub-Total</strong></div></td>
              <td width="58"><div align="center"><strong>Eliminar</strong></div></td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><input name="button" type="button" onClick="addPerson()" value="Agregar"></td>
      </tr>
      <tr>
        <td><div align="right"><strong>Sub-Total</strong></div></td>
        <td><div align="right">
          <input  size='10' type='text' name="sub" onKeyDown='fncActualizar' value='0'>
        </div></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><div align="right"><strong>Iva</strong></div></td>
        <td><div align="right">
          <input  size='10' type='text' name="iva" onKeyDown='fncActualizar' value='0'>
        </div></td>
        <td><div align="right"></div></td>
      </tr>
      <tr>
        <td width="435"><div align="right"><strong>Total</strong></div></td>  
        <td width="93">
    <div align="right">
      <input  size='10' type='text' name="total" onKeyDown='fncActualizar' value='0'>
    </div></td>
        <td width="73">
          <div align="right"></div></td>
      </tr>
   </table>
<p align="center">
  </td>
  </tr>
<tr>
  <td align=right>&nbsp;</td>
  <td>&nbsp;</td>
</tr>

</p>
 </form>
</body>
</html>

 
 

Selena


 
13/01/2009    01:11


Registrado: 14/04/2004
Nº mensajes: 491

  Living QuotePrivado  
 
Hola Selena, no he tenido mucho tiempo para perfeccionar el código pero con el que te paso ya te puedes hacer una idea y mejorarlo.

<?php
function mostrarProductos () {
    $link = mysql_connect("localhost", "root","");
    mysql_select_db("bd", $link);
    $c = mysql_query ("select * from Producto where codigop='$codigo'") or die(mysql_error());
   $select = "";
    while ($res = mysql_fetch_array($c)) {
     $select .= "<option value ='".$res['codigop']."'>".$res['codigo'] ."</option>";
    }
    return $select;
 }
 
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ejemplo formulario</title>

<script language="javascript" type="text/javascript">
var indiceFilaFormulario=1;
function addPerson(){
 myNewRow = document.getElementById("tablaFormulario").insertRow(-1);
 myNewRow.id=indiceFilaFormulario;
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td> <input size='10' type='text' name='codigo["+indiceFilaFormulario+"]' ><?=mostrarProductos(); ?></td>";
 
  myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td> <input size='20' type='text' name='nombre["+indiceFilaFormulario+"]' ></td>";
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input size='6' type='text' name='cant["+indiceFilaFormulario+"]' id='cant"+indiceFilaFormulario+"' onKeyUp='fncActualizar("+indiceFilaFormulario+")'</td>";
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input size='7'  type='text' name='precio["+indiceFilaFormulario+"]' id='precio"+indiceFilaFormulario+"' onKeyUp='fncActualizar("+indiceFilaFormulario+")'</td>";
 
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input  size='10' type='text' name='sub["+indiceFilaFormulario+"]'  id='sub"+indiceFilaFormulario+"' value='0'> </td>";
 
  myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td><input class='red' type='button' value='-' onclick='removePerson(this)'  ></td>";
 indiceFilaFormulario++;
 
}
function removePerson(obj){
 var oTr = obj;
 while(oTr.nodeName.toLowerCase()!='tr'){
  oTr=oTr.parentNode;
 }
 var root = oTr.parentNode;
 root.removeChild(oTr);
}

var total;
function fncActualizar(indiceFilaFormulario)
{
var total = document.getElementById("total");
var subt=document.getElementById("sub");
var iva=document.getElementById("iva");
subt.value=0;
for (i=1;i<=indiceFilaFormulario;i++){
    var sub = document.getElementById("sub"+i);
    var precio = document.getElementById("precio"+i);
    var cant = document.getElementById("cant"+i);
    sub.value=parseInt(precio.value)*parseInt(cant.value);
    subt.value=parseInt(subt.value)+parseInt(sub.value);
 }
 total.value=parseInt(subt.value)+(parseInt(subt.value)*parseInt(iva.value)/100);
};
</script>
</head>
<body>
 <form action="formu.php" name="formulario" method="post">
<table width="603" align="center" cellpadding="0" cellspacing="0" >
      <tr>
        <td colspan="3" align="center">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">
 <table width="600" align="center" cellpadding='3' cellspacing='3' bgcolor="#91E3FB" id="tablaFormulario" style="border:#CBDDEB">
            <tr bgColor='#95C6F7'>
              <td width="69"><div align="center"><strong>Codigo </strong></div></td>
              <td width="147"><div align="center"><strong>Nombre</strong></div></td>
              <td width="87"><div align="center"><strong>Precio</strong></div></td>
     <td width="85"><div align="center"><strong>Cantidad</strong></div></td>
      <td width="89"><div align="center"><strong>Sub-Total</strong></div></td>
              <td width="58"><div align="center"><strong>Eliminar</strong></div></td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><input name="button" type="button" onClick="addPerson()" value="Agregar"></td>
      </tr>
      <tr>
        <td><div align="right"><strong>Sub-Total</strong></div></td>
        <td><div align="right">
          <input  size='10' type='text' name="sub" id="sub" onKeyDown='fncActualizar' value='0'>
        </div></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><div align="right"><strong>Iva</strong></div></td>
        <td><div align="right">
          <input  size='10' type='text' name="iva" id="iva" onKeyDown='fncActualizar' value='0'>
        </div></td>
        <td><div align="right"></div></td>
      </tr>
      <tr>
        <td width="435"><div align="right"><strong>Total</strong></div></td> 
        <td width="93">
    <div align="right">
      <input  size='10' type='text' name="total" id="total" onKeyDown='fncActualizar' value='0'>
    </div></td>
        <td width="73">
          <div align="right"></div></td>
      </tr>
   </table>

 </form>
</body>
</html>
 
 

El mayor placer de un hombre inteligente es aparentar ser idiota, delante de un idiota que aparenta ser inteligente.



 
14/01/2009    21:46


Registrado: 04/01/2009
Nº mensajes: 5

  Selena QuotePrivado  
 
 Living  Muchas gracias por tu ayuda cualquier nos vemos
 
 

Selena


 
17/01/2009    20:39


Registrado: 14/04/2004
Nº mensajes: 491

  Living QuotePrivado  
 
Muchas de nadas 
 
 

El mayor placer de un hombre inteligente es aparentar ser idiota, delante de un idiota que aparenta ser inteligente.



 
28/01/2009    05:48

 
Registrado: 20/08/2008
Nº mensajes: 4

  Daniken QuotePrivado  
 
Hola Living como te va, nuevamente estoy por aca pidiendote ayuda con este fabuloso script, lo he modificado bastante y a continuación te coloco el codigo bastante resumido (153 lineas) a ver si me puedes ayudar, si lo deseas te puedo postear el codigo completo o te lo puedo enviar por correo, no tengo problema alguno en compartirlo (pero son 733 lineas).

Mi problema es el siguiente puede generar todos los campos sin ningun inconveniente pero al momento de procesarlo no obtengo ningun valor, ya sea que realice un  foreach ($_POST["tipoA"] as $indice => $tipoA) {  o simplemente haga un echo $_POST["tipoA1"]; las variables siempre retornan en blanco, por mas que reviso no se donde estoy metiendo la pata. Gracias por todo amigo

<?
$con = mysql_connect("localhost","root","123") or die (mysql_error());
mysql_select_db("nomina",$con) or die (mysql_error());
if (isset($_POST["tipoA"])){
     foreach ($_POST["tipoA"] as $indice => $tipoA) { 
         $cantidad=$_POST["cantidad2"][$indice];
                echo $tipoA;  echo $cantidad;
      } }

?>
<HTML>
<HEAD>
<script language="javascript" type="text/javascript">
var indiceFilaFormulario2=1;
function addPerson2(){
 myNewRow= document.getElementById("tablaFormulario2").insertRow(-1);
 myNewRow.id=indiceFilaFormulario2;
 myNewCell=myNewRow.insertCell(-1);
var nuevoSelect="";
 nuevoSelect+="<td class=a  width=260> <select name='tipoA"+indiceFilaFormulario2+"' id='tipoA"+indiceFilaFormulario2+"' onChange=mostrarTexto2("+indiceFilaFormulario2+") >";
 nuevoSelect+="<option value='0'>Elija una Opción</option> ";
 nuevoSelect+="<option value='B'>Bono</option> ";
 nuevoSelect+="<option value='HED'>Horas Extras Diurnas</option> ";
 nuevoSelect+="<option value='HEN'>Horas Extras Nocturnas</option> ";
 nuevoSelect+="<option value='C'>Cena</option> ";
 nuevoSelect+="<option value='T'>Transporte</option> ";
 nuevoSelect+="</select></td>";
myNewCell.innerHTML=nuevoSelect
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td class=a width='50'><input onkeyup=\"this.value = this.value.replace (/[^0-9^,]/, ''); javascript:fncActualizarA("+indiceFilaFormulario2+")\" class='ghost' type='text' size='5' name='cantidad2"+indiceFilaFormulario2+"' id='cantidad2"+indiceFilaFormulario2+"' ></td>";
  myNewCell=myNewRow.insertCell(-1);
myNewCell.innerHTML="<td class=a width='80'><input class='ghost' disabled size='10' type='text' name='importe2"+indiceFilaFormulario2+"' id='importe2"+indiceFilaFormulario2+"'></td>";
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td class=a  width='110'><input class='ghost'disabled size='10' type='text' name='asignacion"+indiceFilaFormulario2+"' id='asignacion"+indiceFilaFormulario2+"'> </td>";
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td class=a width='110'><input class='ghost' size='10' disabled></td>";
 myNewCell=myNewRow.insertCell(-1);
 myNewCell.innerHTML="<td class=a><input type='button'  value='-' onclick='removePerson2(this)'></td>";
 indiceFilaFormulario2++;
}
function removePerson2(obj){
 var oTr = obj;
 while(oTr.nodeName.toLowerCase()!='tr'){
  oTr=oTr.parentNode;
 }
 var root = oTr.parentNode;
 root.removeChild(oTr);
}

</script>

</HEAD>
<body onLoad="show5()" TOPMARGIN=0  MARGINHEIGHT=0>
        <table>
        <tr><td><table>
        <tr><td>

        </td></tr>
        </table></td></tr>
        <tr><td><form action="<?= $_SERVER['REQUEST_URI'] ?>" name="formulario" method="post">
        <table cellspacing="3" cellpadding="3">
        <tr>
        <td>
        <input type="submit" class="save"  value="GUARDAR" onClick="this.form.submit();"></td>
        <td width="70"></td>
        <td><? echo"<p>".$_pagi_navegacion."</p>"; ?></td>
        </tr>
        </table>
        </td></tr>
<tr><td> <table class="a" cellpadding="2" cellspacing="4" width="600" border="1">
<tbody class="a">
<tr>
<td>
 
<table><tr><td> <table cellpadding="2" cellspacing="2">
<tr><td><p>Año:</td><td><input name="ano" size="6" value="<? echo date(Y)?>"></td>
<td><p>Mes:</td><td><Select name="mes">
<option value="01" <? if ($day=='01') {echo 'selected=true';} ?>>Enero</option>
<option value="02" <? if ($day=='02') {echo 'selected=true';} ?>>Febrero</option>
<option value="03" <? if ($day=='03') {echo 'selected=true';} ?>>Marzo</option>
<option value="04" <? if ($day=='04') {echo 'selected=true';} ?>>Abril</option>
<option value="05" <? if ($day=='05') {echo 'selected=true';} ?>>Mayo</option>
<option value="06" <? if ($day=='06') {echo 'selected=true';} ?>>Junio</option>
<option value="07" <? if ($day=='07') {echo 'selected=true';} ?>>Julio</option>
<option value="08" <? if ($day=='08') {echo 'selected=true';} ?>>Agosto</option>
<option value="09" <? if ($day=='09') {echo 'selected=true';} ?>>Septiembre</option>
<option value="10" <? if ($day=='10') {echo 'selected=true';} ?>>Octubre</option>
<option value="11" <? if ($day=='11') {echo 'selected=true';} ?>>Noviembre</option>
<option value="12" <? if ($day=='12') {echo 'selected=true';} ?>>Diciembre</option></select></td>
<? $wek =  strftime("%W");?>
<td><p>Semana:</td><td><Select name="semana">
<? $ii=1; while ($ii<=52) {?>
<option value="<? echo $ii; ?>" <? if ($wek==$ii) {echo 'selected=true';} ?>><? echo $ii; ?></option>
<? $ii++; } ?>
</select></td>
<td align="left"><p>Fecha inicial:</td><td><input class="dashboard" readonly="readonly" id="date" name="date" type="text"></td>
<td>
</td></tr></table></td></tr>
<tr><td> <table cellpadding="2" cellspacing="2">
</table></td></tr>

<tr><td> <table cellpadding="2" cellspacing="2" border="0">
<tr><td><p>Nombre:<input name="id" type="hidden" size="3" value="<? echo $row['id_emp'] ; ?>"></td><td><input name="nombre" size="41" value="<? echo $row['ape_emple'] ." ". $row['nom_emple']?>"></td><td><p>C.I.:</td><td><input name="cedula" size="10" value="<? echo $row['cedula'] ; ?>"></td><td><p>Sueldo:</td><td><input name="sueldo" size="10" value="<? $tempi1=$row['sueldo_actual'];  echo number_format($tempi1,2,",",".") ; ?>"></td></tr></table></td></tr>
<tr><td>
<table class="a" cellpadding="2" cellspacing="2" border="1"  id="tablaFormulario2"> 
<thead class="a">
<tr class="a">
<th class="a" width="250"><p><font color="white">Concepto Asignación</font></p></th>
<th class="a" width="50"><p><font color="white">Cantidad</font></p></th>
<th class="a" width="80"><p><font color="white">Importe</font></p></th>
<th class="a" width="110"><p><font color="white">Asignaciones</font></p></th>
<th class="a" width="110"><p><font color="white"></font></p></th>
<th class="a" width="50"><p><font color="white">Sup</font></p></th></tr>
</thead>
<tbody class="a" >
<tr class="a" >
<td class="a" width="250"><p>Sueldo Básico Diario</p></td>
<td class="a" width="50" >
<input name="sueldo_a" type='hidden' size='5' value="<? echo $row['sueldo_actual'] ; ?>">
<input class="ghost" name="sueldoc" type='text' size='5' value="7"></td>
<td class="a" width="80"  align="right"><p>
<input class="ghost" disabled name="sueldo1" size="10" value="<?  echo number_format($tempi1,2,",",".") ; ?>"></font></p></td>
<td class="a" width="110"  align="right"><p>
<input class="ghost" disabled name="sueldo2" size="10" value="<? echo number_format(($tempi1*7),2,",",".") ; ?>"></p>
<input type="hidden" class="ghost"  name="sueldoh" size="10" value="<? echo number_format(($tempi1*7),2,",",".") ; ?>"></td>
<td class="a" width="110"  align="right">
<input class="ghost" disabled size="10"></td>
<td class="a" width="50"><p></p></td></tr>
</table><tr>
        <td align="left" class="a" colspan="6">
<input type="button" onClick="addPerson2()" value="+ Asignaciones" ></td>
      </tr>
</td></tr>
<?
$temporal = $tempi2 + $tempi3 + $tempi4;
$tempi0=$tempi1*7
?>
<tr><td><table class="a"><tfoot class="a"><tr class="a" >
<th class="a" width="250" align="right">Neto a Pagar</td>
<th class="a" width="130" align="right">
<input type="hidden" name="neto" size="10" value="<? echo number_format(($tempi0-$temporal),2,".","") ; ?>">
<input class="ghost2" name="neto1" size="10" value="<? echo number_format(($tempi0-$temporal),2,",",".") ; ?>">&nbsp;&nbsp;&nbsp;=</th>
<th class="a" width="110" align="right">
<input type="hidden" name="Tasigna" disabled size="10" value="<?; echo number_format($tempi0,2,".","");?>">
<input class="ghost2" name="Tasigna1" disabled size="10" value="<?; echo number_format($tempi0,2,",",".");?>">&nbsp;&nbsp;&nbsp;-</th>
<th class="a" width="110" align="right">
<input type="hidden" name="Tdeducc" size="10" value="<? echo number_format($temporal,2,".","");?>">
<input class="ghost2" name="Tdeducc1" size="10" value="<? echo number_format($temporal,2,",",".");?>"></p></th>
<th class="a" width="50" align="right">&nbsp;</td></tr></tfoot></table></td></tr>
</table>
</td>
</table></td></tr></form>
</tbody>
        </table>

</body>
</html>
 
 
 
03/02/2009    12:30


Registrado: 14/04/2004
Nº mensajes: 491

  Living QuotePrivado  
 
Hola Dakinen,

Siento mucho la tardanza pero últimamente estoy más liado que la pata de un romano

Para solucionar tu problema simplemente pon la línea de la etiqueta <form> debajo de <body> y el cierre del formulario justo encima de </body>

<body onLoad="show5()" TOPMARGIN=0  MARGINHEIGHT=0>
<form action="<?= $_SERVER['REQUEST_URI'] ?>" name="formulario" method="post">
...
...
...
</form>
</body>

Un saludo!!
 
 

El mayor placer de un hombre inteligente es aparentar ser idiota, delante de un idiota que aparenta ser inteligente.



 
12/02/2009    20:27

 
Registrado: 12/02/2009
Nº mensajes: 1

  jdlfuente QuotePrivado  
 
hola como estas me podrian ayudar con esto es algo similar necesito que a partir de otros campos de un  formulario ir creando registros con datos sacados de otros text o combos dinamicamente como podria hacer esto no se mucho de javascript, hace bastante que ando dando vueltas con esto lo necesito urgente por favor desde ya muchas gracias.- 
jose 
 
 
 
26/02/2009    02:29


Registrado: 26/02/2009
Nº mensajes: 2

  victorbatan QuotePrivado  
 
Hola Living:

Yo necesitaría poder verificar que, cuando hago el submit, poder verificar que al menos ingresé un dato, es decir, tengo dos campos, un text y un radio, la idea es que todos los text que ingreso y, al menos, un radio estén completos.
No se como hacer con javascript esto. si tengo un funcion de verificar los campos de las otras partes de un formulario, pero como esto es dinámico, no se cómo pasar el parámetro.

Bueno, muchas gracias !! Saludos
 
 

es real lo real?


 
27/02/2009    12:52


Registrado: 14/04/2004
Nº mensajes: 491

  Living QuotePrivado  
 
Hola Víctor!

Como en todo momento sabes el número de registros insertados (lo tienes en la variable indiceFilaFormulario ) lo único que tienes que hacer es llamar a una función en el onsubmit que compruebe si el usuario a rellenado los datos. Por ejemplo:

function checkFormulario(){

for (i=1;i<indiceFilaFormulario;i++){
    if (eval("document.formulario.nombre["+i+"]").value=""){
      alert("rellene todos los campos");
       return false;
    }

}

}

Puede ser que me haya equivocado escribiendo el ejemplo ya que no lo he probado pero es para que te hagas una idea de como puedes hacerlo.

Un par de apuntes. Este post lo cree hace más de 2 años. Ahora se recomienda no usar un "nombre" para el formulario. Así que para acceder a los elementos del mismo lo mejor es que créis un id en  cada input con el mismo valor que el name que tenga. Después acceder a ellos es tan sencillo como usar un document.getElementById.
 
 

El mayor placer de un hombre inteligente es aparentar ser idiota, delante de un idiota que aparenta ser inteligente.



 
       << < [6] 7 >