Forum Moderators: open
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!