Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > submiting to a parent window from a popup child window?

Reply
Thread Tools

submiting to a parent window from a popup child window?

 
 
midnight_use_only@yahoo.com
Guest
Posts: n/a
 
      06-10-2006
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!

 
Reply With Quote
 
 
 
 
midnight_use_only@yahoo.com
Guest
Posts: n/a
 
      06-12-2006
anyone? any idea?

http://www.velocityreviews.com/forums/(E-Mail Removed) 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!


 
Reply With Quote
 
 
 
 
Seige
Guest
Posts: n/a
 
      06-12-2006
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



(E-Mail Removed) wrote:
> anyone? any idea?
>
> (E-Mail Removed) 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!


 
Reply With Quote
 
midnight_use_only@yahoo.com
Guest
Posts: n/a
 
      06-12-2006
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

>
>
> (E-Mail Removed) wrote:
> > anyone? any idea?
> >
> > (E-Mail Removed) 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!


 
Reply With Quote
 
Seige
Guest
Posts: n/a
 
      06-12-2006
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)



(E-Mail Removed) 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
>
> >
> >
> > (E-Mail Removed) wrote:
> > > anyone? any idea?
> > >
> > > (E-Mail Removed) 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!


 
Reply With Quote
 
dzhuo1@gmail.com
Guest
Posts: n/a
 
      06-13-2006
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)
>
>
>
> (E-Mail Removed) 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
> >
> > >
> > >
> > > (E-Mail Removed) wrote:
> > > > anyone? any idea?
> > > >
> > > > (E-Mail Removed) 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!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
Results from child window submit into parent window, then child closes -- How To? Spammay Blockay Javascript 1 02-04-2005 12:47 PM
Pass from parent to child, then update parent with child value... Noel Dolan Javascript 0 07-18-2004 05:52 PM
Solution: Raising an Event Handler Postback on Parent Window From Popup Child Window Dialog Box Earl Teigrob ASP .Net 1 06-16-2004 04:19 PM
Submiting form to a popup in IE 6.0.2800.1106 Pat Javascript 1 01-20-2004 08:38 AM



Advertisments