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! 5 7964
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!
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!
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!
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!
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!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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:...
|
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:
...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |