473,394 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

submiting to a parent window from a popup child window?

hi all,
quick question, how do you submit a form to a parent window from a
child popup window? i have the following and all online documentation
*suggests* that it should work but it does NOT:

// Parent window:
<script language="JavaScript">
function popup(url, name)
{
window.open(url, name, "width=800,height=600,scrollbars=yes");
return false;
}
</script>
....
<form name=form1 method=post action=something.php>
<input type=hidden name=h1 value='' >
<a href="#"
target="childWindowName" onclick="return popup('url.php','Some
name');">Pop</a>
....
</form>

// Now in the child popup window
<script language="JavaScript">
function handleSubmit(aValue)
{
var myParent = opener.document.forms.form1;
myParent.h1.value=aValue;
myParent.submit(); // ERROR: Object doesn't support this property
or method
return true;
}
</script>
<a href=# onclick="handleSubmit(2006);">Submit</a>

i have spent a few hours searching online and all the examples
indicates that this example should work but it doesn't, not in IE or
FF. in FF, nothing happen and in IE, the following error show up:

Object doesn't support this property or method

any idea? thanks!

Jun 10 '06 #1
5 8008
anyone? any idea?

mi***************@yahoo.com wrote:
hi all,
quick question, how do you submit a form to a parent window from a
child popup window? i have the following and all online documentation
*suggests* that it should work but it does NOT:

// Parent window:
<script language="JavaScript">
function popup(url, name)
{
window.open(url, name, "width=800,height=600,scrollbars=yes");
return false;
}
</script>
...
<form name=form1 method=post action=something.php>
<input type=hidden name=h1 value='' >
<a href="#"
target="childWindowName" onclick="return popup('url.php','Some
name');">Pop</a>
...
</form>

// Now in the child popup window
<script language="JavaScript">
function handleSubmit(aValue)
{
var myParent = opener.document.forms.form1;
myParent.h1.value=aValue;
myParent.submit(); // ERROR: Object doesn't support this property
or method
return true;
}
</script>
<a href=# onclick="handleSubmit(2006);">Submit</a>

i have spent a few hours searching online and all the examples
indicates that this example should work but it doesn't, not in IE or
FF. in FF, nothing happen and in IE, the following error show up:

Object doesn't support this property or method

any idea? thanks!


Jun 12 '06 #2
First things first, both your pages (parent and child) must be under
the same domain and/or path. If this is the case then it could be that
you gave the window wrong names...
<form name=form1 method=post action=something.php>
<input type=hidden name=h1 value='' >
<a href="#"
target="childWindowName" onclick="return popup('url.php','Some
name');">Pop</a>
...
</form>

where does childWindowName reference to? is it necessary for it to be
there?

'Some name' shouldn't have any spaces in between, so you might want to
consider 'Some_name'

otherwise you could try the onsubmit attribute in form1

mi***************@yahoo.com wrote: anyone? any idea?

mi***************@yahoo.com wrote:
hi all,
quick question, how do you submit a form to a parent window from a
child popup window? i have the following and all online documentation
*suggests* that it should work but it does NOT:

// Parent window:
<script language="JavaScript">
function popup(url, name)
{
window.open(url, name, "width=800,height=600,scrollbars=yes");
return false;
}
</script>
...
<form name=form1 method=post action=something.php>
<input type=hidden name=h1 value='' >
<a href="#"
target="childWindowName" onclick="return popup('url.php','Some
name');">Pop</a>
...
</form>

// Now in the child popup window
<script language="JavaScript">
function handleSubmit(aValue)
{
var myParent = opener.document.forms.form1;
myParent.h1.value=aValue;
myParent.submit(); // ERROR: Object doesn't support this property
or method
return true;
}
</script>
<a href=# onclick="handleSubmit(2006);">Submit</a>

i have spent a few hours searching online and all the examples
indicates that this example should work but it doesn't, not in IE or
FF. in FF, nothing happen and in IE, the following error show up:

Object doesn't support this property or method

any idea? thanks!


Jun 12 '06 #3
comments below...

Seige wrote:
First things first, both your pages (parent and child) must be under
the same domain and/or path. If this is the case then it could be that
you gave the window wrong names...
yes the parent and the child window are under the same domain and same
path.
<form name=form1 method=post action=something.php>
<input type=hidden name=h1 value='' >
<a href="#"
target="childWindowName" onclick="return popup('url.php','Some
name');">Pop</a>
...
</form>

where does childWindowName reference to? is it necessary for it to be
there?


it's not referenced anywhere. correct me if i am wrong (most likely),
target="childWindowName" is the name of the child window and is
required for a popup right? otherwise, i could have use something like
target=_blank

'Some name' shouldn't have any spaces in between, so you might want to
consider 'Some_name'
actually, it doesn't have space in the actual code. iti's my mistake to
have a space here

otherwise you could try the onsubmit attribute in form1

i suppose i could do that but i am more interested to find out why my
solution doesn't work in the first place where all online documentation
and code example suggests that it should. i think you are on the right
track that i must have some sort of name-reference thing mess up
between the child and the parent window but the thing is i can get a
reference of the parent window and setting hidden field variables and
such, it's just the submit() method keep saying it's not support


mi***************@yahoo.com wrote:
anyone? any idea?

mi***************@yahoo.com wrote:
hi all,
quick question, how do you submit a form to a parent window from a
child popup window? i have the following and all online documentation
*suggests* that it should work but it does NOT:

// Parent window:
<script language="JavaScript">
function popup(url, name)
{
window.open(url, name, "width=800,height=600,scrollbars=yes");
return false;
}
</script>
...
<form name=form1 method=post action=something.php>
<input type=hidden name=h1 value='' >
<a href="#"
target="childWindowName" onclick="return popup('url.php','Some
name');">Pop</a>
...
</form>

// Now in the child popup window
<script language="JavaScript">
function handleSubmit(aValue)
{
var myParent = opener.document.forms.form1;
myParent.h1.value=aValue;
myParent.submit(); // ERROR: Object doesn't support this property
or method
return true;
}
</script>
<a href=# onclick="handleSubmit(2006);">Submit</a>

i have spent a few hours searching online and all the examples
indicates that this example should work but it doesn't, not in IE or
FF. in FF, nothing happen and in IE, the following error show up:

Object doesn't support this property or method

any idea? thanks!


Jun 12 '06 #4
Hmm... i'm clueless as to why this happen. Usually when something like
this happens, I would regard it as another "Browser-Securit-Issue" and
proceed with the workaround. (aka onsubmit)

mi***************@yahoo.com wrote:
comments below...

Seige wrote:
First things first, both your pages (parent and child) must be under
the same domain and/or path. If this is the case then it could be that
you gave the window wrong names...


yes the parent and the child window are under the same domain and same
path.
> <form name=form1 method=post action=something.php>
> <input type=hidden name=h1 value='' >
> <a href="#"
> target="childWindowName" onclick="return popup('url.php','Some
> name');">Pop</a>
> ...
> </form>


where does childWindowName reference to? is it necessary for it to be
there?


it's not referenced anywhere. correct me if i am wrong (most likely),
target="childWindowName" is the name of the child window and is
required for a popup right? otherwise, i could have use something like
target=_blank

'Some name' shouldn't have any spaces in between, so you might want to
consider 'Some_name'


actually, it doesn't have space in the actual code. iti's my mistake to
have a space here

otherwise you could try the onsubmit attribute in form1


i suppose i could do that but i am more interested to find out why my
solution doesn't work in the first place where all online documentation
and code example suggests that it should. i think you are on the right
track that i must have some sort of name-reference thing mess up
between the child and the parent window but the thing is i can get a
reference of the parent window and setting hidden field variables and
such, it's just the submit() method keep saying it's not support


mi***************@yahoo.com wrote:
anyone? any idea?

mi***************@yahoo.com wrote:
> hi all,
> quick question, how do you submit a form to a parent window from a
> child popup window? i have the following and all online documentation
> *suggests* that it should work but it does NOT:
>
> // Parent window:
> <script language="JavaScript">
> function popup(url, name)
> {
> window.open(url, name, "width=800,height=600,scrollbars=yes");
> return false;
> }
> </script>
> ...
> <form name=form1 method=post action=something.php>
> <input type=hidden name=h1 value='' >
> <a href="#"
> target="childWindowName" onclick="return popup('url.php','Some
> name');">Pop</a>
> ...
> </form>
>
> // Now in the child popup window
> <script language="JavaScript">
> function handleSubmit(aValue)
> {
> var myParent = opener.document.forms.form1;
> myParent.h1.value=aValue;
> myParent.submit(); // ERROR: Object doesn't support this property
> or method
> return true;
> }
> </script>
> <a href=# onclick="handleSubmit(2006);">Submit</a>
>
> i have spent a few hours searching online and all the examples
> indicates that this example should work but it doesn't, not in IE or
> FF. in FF, nothing happen and in IE, the following error show up:
>
> Object doesn't support this property or method
>
> any idea? thanks!


Jun 12 '06 #5
unfortunetly, onsubmit() won't work too because the form is not
submited so the event is never trigger. i did solve this prolbme by
using this:

// myParent.submit(); -- does NOT work
myParent.mySubmitButton.click(); // this does work

by using the click() event, it does exactly what i need. i still have
no idea why submit() doesn't work.

Seige wrote:
Hmm... i'm clueless as to why this happen. Usually when something like
this happens, I would regard it as another "Browser-Securit-Issue" and
proceed with the workaround. (aka onsubmit)

mi***************@yahoo.com wrote:
comments below...

Seige wrote:
First things first, both your pages (parent and child) must be under
the same domain and/or path. If this is the case then it could be that
you gave the window wrong names...


yes the parent and the child window are under the same domain and same
path.

> > <form name=form1 method=post action=something.php>
> > <input type=hidden name=h1 value='' >
> > <a href="#"
> > target="childWindowName" onclick="return popup('url.php','Some
> > name');">Pop</a>
> > ...
> > </form>

where does childWindowName reference to? is it necessary for it to be
there?


it's not referenced anywhere. correct me if i am wrong (most likely),
target="childWindowName" is the name of the child window and is
required for a popup right? otherwise, i could have use something like
target=_blank

'Some name' shouldn't have any spaces in between, so you might want to
consider 'Some_name'


actually, it doesn't have space in the actual code. iti's my mistake to
have a space here

otherwise you could try the onsubmit attribute in form1


i suppose i could do that but i am more interested to find out why my
solution doesn't work in the first place where all online documentation
and code example suggests that it should. i think you are on the right
track that i must have some sort of name-reference thing mess up
between the child and the parent window but the thing is i can get a
reference of the parent window and setting hidden field variables and
such, it's just the submit() method keep saying it's not support


mi***************@yahoo.com wrote:
> anyone? any idea?
>
> mi***************@yahoo.com wrote:
> > hi all,
> > quick question, how do you submit a form to a parent window from a
> > child popup window? i have the following and all online documentation
> > *suggests* that it should work but it does NOT:
> >
> > // Parent window:
> > <script language="JavaScript">
> > function popup(url, name)
> > {
> > window.open(url, name, "width=800,height=600,scrollbars=yes");
> > return false;
> > }
> > </script>
> > ...
> > <form name=form1 method=post action=something.php>
> > <input type=hidden name=h1 value='' >
> > <a href="#"
> > target="childWindowName" onclick="return popup('url.php','Some
> > name');">Pop</a>
> > ...
> > </form>
> >
> > // Now in the child popup window
> > <script language="JavaScript">
> > function handleSubmit(aValue)
> > {
> > var myParent = opener.document.forms.form1;
> > myParent.h1.value=aValue;
> > myParent.submit(); // ERROR: Object doesn't support this property
> > or method
> > return true;
> > }
> > </script>
> > <a href=# onclick="handleSubmit(2006);">Submit</a>
> >
> > i have spent a few hours searching online and all the examples
> > indicates that this example should work but it doesn't, not in IE or
> > FF. in FF, nothing happen and in IE, the following error show up:
> >
> > Object doesn't support this property or method
> >
> > any idea? thanks!


Jun 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Randell D. | last post by:
Folks, I'm working on a contact name/address database whereby a slimed down list is shown in the main window. When a record is selected, the complete record is displayed in a new window via a...
4
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a...
2
by: Mark | last post by:
Any suggestions on how to go about generating a popup, giving the user a way of searching for something, and then taking their selection after closing the pop-up and populating the parent form with...
4
by: Earl Teigrob | last post by:
I am thinking about using a popup window to edit settings that will affect parent asp.net page. The data that is changed in the popup window will be saved to the datastore that is loaded and...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: Robert Degen | last post by:
Hello, I got a little problem. Seems very simple: * I want to open a popup window * Popup-window uses data from its father window. BUT a parent.window does NOT point to the real parents...
2
by: epaetz | last post by:
Is there a way to decouple the linkage between a parent and a child window? Does the parent window have any sort of a collection that holds all the children that it has spawned? I want to...
2
by: sanscrimson | last post by:
Hi! I just want to ask if it possible to call functions in parent window if the child window is created. Below is sample:...
1
by: Andrew Hayes | last post by:
I have a parent page with a gridview, and a child page with a formview. Using the solution on velocityreviews: ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.