Forum Moderators: open

Message Too Old, No Replies

Parent window problem

         

tekno

8:34 am on Mar 1, 2005 (gmt 0)



Hi to all,

I have some problems with javascript and I hope someone will help... :)

Here is the short description:

I have one php page with form. When a curten field is set in form, it opens the new php script in a new window, passing the value of a filed that triggered the action.

This is working so far... ;) The new script generates some checkboxes with their values. What I need to do now is to pass that values to parent window (form), submit the parent form and close the child window.

What I came up with is this:

<script language="javascript">

<!--
function submitParent(total) {
var cb;

for (var i=1; i<=total; i++)
{
cb = "cb"+i;

if (document.getElementById(cb).checked == true) {
window.opener.forma.temp.value +=","+document.getElementById(cb).value;
}
}

window.opener.forma.submit();
parent.close();
}
//-->

</script>

total is count of checkboxes
cb is checkbox name

As you can see, it should generate the array of checked id's and pass it to parent window.

When I run the script it gives me this error:

Error: window.opener.forma has no properties
Source File: ....
Line: ...

I'm not so familiar with javascript, just to notice it :).

Thanks,
Cheers!

orion_rus

8:22 am on Mar 4, 2005 (gmt 0)

10+ Year Member



But why you need a open window. U can make hidden iframe and send your variables with a get method like what
<iframe src='mypage.php?myvalue=hi&myparent=true' ></iframe>
and so on with a javascript you can change iframe src
Good luck to you