Ver Mensaje Individual
  #23 (permalink)  
Antiguo 26/09/2008, 11:54
jcouoh
 
Fecha de Ingreso: septiembre-2003
Ubicación: Merida, yucatan
Mensajes: 282
Antigüedad: 20 años, 8 meses
Puntos: 1
Respuesta: No me funciona pasar valores entre ventanas

Correcto, segui tus indicaciones y funciona adecuadamente el asunto de clonar dinamicamente, aunque todavía no envia los datos al formulario padre.

ahora, pregunto, ¿si el formulario padre contiene otros inputs, y no necesito clonarlos? como le haría????

Esto es lo que hice:

Formulario padre:

Código HTML:
<html><head></head><body>

<div id="bloque" style="float:left; width:80px; ">
<form name="frm" id="frm">

<table width="80"><tr><td>

<input type=text 
name="GtoFecha" id="GtoFecha"
value="">

</td></tr>

</table>

</form>

</div>

<a href="#" title="" onClick="window.open('003.html')" 

width="400" height="200">Gastos</a>



</body></html> 

formulario hijo:

Código HTML:
<html>
<head>
<title></title>

</head>
<body>


<table width=2000> <tr><td width=110 height=50>

<table>
<tr><td class="td" align=right>Fecha:</td></tr>


</table></td><td>
<form id="myform" name="myform" action="<?php echo 

$_SERVER['PHP_SELF'] ?>" method="post">

<div id="bloque" style="float:left; width:80px; ">
<table width="80"><tr><td>

<input type=text class=input1
name="GtoFecha" id="GtoFecha"
value="">



</td></tr>

</table>
</div>


</form>

</td></tr></table>
<form><div style="clear:both; padding-top:15px"><button 

type="button" onClick="doIt()">Gasto Nuevo</button>
    <br>
    <br>
<input name="e" type="button" id="e" value="Enviar" 

onclick="document.getElementById('myform').submit()">
</div></form>
<script>
function doIt()
{
var f = document.getElementById('myform');
var b = document.getElementById('bloque');
var b2=b.cloneNode(true);
f.appendChild(b2);

var g = opener.document.getElementById('frm');
var h = opener.document.getElementById('bloque');

var g2=g.cloneNode(true);

h.appendChild(g2);




}

</script>

<?php

/*
if(isset($_POST) && !empty($_POST)){
echo '<pre>';
print_r($_POST);
echo '<pre>';
}

*/
?>


<a href="JavaScript:close();" title="pasar valor" 

onClick="regreso()">Regresar a la Ventana Principal</a>


<script>



function regreso()

{
var indice;
var ind;
indice=document.myform.GtoFecha.length;


for (ind = 0; ind<indice; ind++)

{
window.opener.document.frm.GtoFecha[ind].value = 

window.document.myform.GtoFecha[ind].value;


}



}



</script>

</body>
</html>