473,387 Members | 1,700 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,387 software developers and data experts.

submit opener form after submitting pop-up form

Hi,

I want to use the submit button of a new window to submit the form of the
new window (which carries two values to the opener window) and then submit
the opener form.

Can anyone tell me how to do this?

Jul 20 '05 #1
7 12420
Marco Alting wrote:
I want to use the submit button of a new window to submit the form of the
new window (which carries two values to the opener window) and then submit
the opener form.

Can anyone tell me how to do this?


In the document of the new window:

<form ...
onsubmit="window.setTimeout('opener.document.forms[...].submit()', 42);
return true;"> <!-- one line recommended -->

YMMV
PointedEars
Jul 20 '05 #2
It doesn't seem to work, the onsubmit in the pop-up has a function to it
called setOpener(this), which sends values to variables in the opener form,
after that it should submit the opener form, but it doesn't. Here's the
setOpener function:

function setOpener(oForm) {
if (opener && !opener.closed) {
var recordNo =
self.location.search.substring(1,self.location.sea rch.length);
var opener_form = opener.document.forms[0];
if (opener_form){
var chNo = eval('opener_form.changeNumber' + recordNo);
chNo.value = oForm.chNo.value;
var chDesc = eval('opener_form.changeDescription' + recordNo);
chDesc.value = oForm.chDesc.value;
}
self.close();
window.setTimeout('opener.document.forms[0].checkForm()', 42);
return true;
}
}
"Thomas 'PointedEars' Lahn" <Po*********@web.de> schreef in bericht
news:3F************@PointedEars.de...
Marco Alting wrote:
I want to use the submit button of a new window to submit the form of the new window (which carries two values to the opener window) and then submit the opener form.

Can anyone tell me how to do this?


In the document of the new window:

<form ...
onsubmit="window.setTimeout('opener.document.forms[...].submit()', 42);
return true;"> <!-- one line recommended -->

YMMV
PointedEars

Jul 20 '05 #3
It doesn't seem to work, the onsubmit in the pop-up has a function to it
called setOpener(this), which sends values to variables in the opener form,
after that it should submit the opener form, but it doesn't. Here's the
setOpener function:

function setOpener(oForm) {
if (opener && !opener.closed) {
var recordNo =
self.location.search.substring(1,self.location.sea rch.length);
var opener_form = opener.document.forms[0];
if (opener_form){
var chNo = eval('opener_form.changeNumber' + recordNo);
chNo.value = oForm.chNo.value;
var chDesc = eval('opener_form.changeDescription' + recordNo);
chDesc.value = oForm.chDesc.value;
}
self.close();
window.setTimeout('opener.document.forms[0].checkForm()', 42);
return true;
}
}
"Thomas 'PointedEars' Lahn" <Po*********@web.de> schreef in bericht
news:3F************@PointedEars.de...
Marco Alting wrote:
I want to use the submit button of a new window to submit the form of the new window (which carries two values to the opener window) and then submit the opener form.

Can anyone tell me how to do this?


In the document of the new window:

<form ...
onsubmit="window.setTimeout('opener.document.forms[...].submit()', 42);
return true;"> <!-- one line recommended -->

YMMV
PointedEars

Jul 20 '05 #4
Marco Alting wrote:
It doesn't seem to work, [...]
self.close();
window.setTimeout('opener.document.forms[0].checkForm()', 42);


`self' is in fact a reference to the same object as `window' is. Once
a window is closed, no further statements of its code can be executed.
Exchange the two lines and it should work (if `checkForm()' actually
submits the opener form.) YMMV for the number of milliseconds to wait
until the opener form should be submitted (here: 42.)
HTH

PointedEars

P.S.
Your way of intendation is IMHO not suited for legible code.
(Most important: Don't use tabs but spaces since the former's
width depends on the display device.)

P.P.S.
Please read http://www.allmyfaqs.com/faq.pl?How_to_post about
top-posts.
Jul 20 '05 #5
Thomas 'Ingrid' Lahn wrote:
P.S.
Your way of intendation is IMHO not suited for legible code.

^^^^^^^^^^^
Typo. Of course `indentation' was meant.
PointedEars
Jul 20 '05 #6
Ofcourse you're right, when a window is closed it cannot perform any action,
but now I've changed the lines around and now the pop-up doesn't close and
the opener is not submitted...

Any more ideas?

Thanks,
M

"Thomas 'PointedEars' Lahn" <Po*********@web.de> schreef in bericht
news:3F**************@PointedEars.de...
Thomas 'Ingrid' Lahn wrote:
P.S.
Your way of intendation is IMHO not suited for legible code.

^^^^^^^^^^^
Typo. Of course `indentation' was meant.
PointedEars

Jul 20 '05 #7
Marco Alting wrote:
[...]
but now I've changed the lines around and now the pop-up doesn't close and
the opener is not submitted...

Any more ideas?
Have you tried to adjust the milliseconds for timeout?
What error messages do you get (in the JavaScript console)?
[...]


Please reply only to the postings you are referring to,
and please put the quote shortened to the text you are
actually referring to *above* your text, not below it:

http://www.allmyfaqs.com/faq.pl?How_to_post
http://www.netmeister.org/news/learn2quote2.html
PointedEars
Jul 20 '05 #8

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

Similar topics

4
by: Yaron C. | last post by:
Hi, I have window A, which open popup A which Open popup C. In the two popups I use a common JavaScript file and in order to distinguish between them I use the following code: if...
2
by: Raphael Bowen Giudice | last post by:
I'm opening a window in my main page using the window.open() function. With the new window opened, how do I call a function or an object from the main page. I'm using the window.opener() function...
16
by: John | last post by:
In an unnamed form, unnamed because it only submits an email address, I'm trying to have the submit button clear the "e-mail" text value in the textbox. On the submit button I have the...
1
by: Ray Slakinski | last post by:
Hello, I have defined a function to set an opener for urllib2, this opener defines any proxy and http authentication that is required. If the proxy has authencation itself and requests an...
5
by: awebguynow | last post by:
to submit or not to submit - that is the question and I'm going to be designing some lengthy forms, where many of the fields may be populated with data, and the user may only want to view it. ...
4
by: Phil Powell | last post by:
I thought this would work but it seems to not work neither in Netscape nor in IE: <script type="text/javascript"> <!-- // OBTAINED FROM http://www.javascripter.net/faq/settinga.htm //...
2
by: ljlolel | last post by:
I'm posting this again because I did not explain myself well the first time, so the problem was not being addressed. I made the following page (...
4
by: Gabriella | last post by:
Hi, I have a popup window that opens from a page on my website. This popup is a form with several fields. Upon submit button it redirects to a server side ASP page which writes all data to the...
2
by: pantagruel | last post by:
As per the subject line, Firefox's error console says document.forms.submit is not a function. the javascript is function makequery(param){ document.forms.qu.value=param;...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.