473,466 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Sending form info from popup window to original window

I have a popup window with a form:

The popup window is opened like this:

<SCRIPT LANGUAGE=javascript>
window.open('primos.html', 'primos', config='height=300, width=400')
</SCRIPT>

The form on the popup window is this:

<form action="primos.php" method="POST">
Buscar los primos entre 1 y
<input type="text" size="7" name="max" value="1000"><br>
<input type="submit" name="start" value="Start">
</form>

How can I get the form to send the info to "primos.php" and open it in
the original window?

Thanks in advance,
Philippe
Jul 20 '05 #1
1 6535
pe**************@yahoo.com (Person) writes:
I have a popup window with a form:

The popup window is opened like this:

<SCRIPT LANGUAGE=javascript>
The "type" attribute is required. This should be
<script type="text/javascript">
window.open('primos.html', 'primos', config='height=300, width=400')
The "config=" is not necessary. The config string should not contain spaces,
some browsers choke on them.
</SCRIPT>

The form on the popup window is this:

<form action="primos.php" method="POST"> .... How can I get the form to send the info to "primos.php" and open it in
the original window?


How do you know that the original window is still open?

If it is open, you can use the target attribute on the form tag to send
the result to that window. This requires you to know the name, if any,
of the original window.

There is a way to find this name (or set it, if there is no name)
dynamically:

<form action="primos.php" method="POST" target="_blank"
onsubmit="if (!opener.closed) {
if (opener.name) {this.target=opener.name;}
else {
this.target = opener.name =
'primosWindowName'+Math.floor(Math.random()*10000) ;
}}">

If the original window exists, then we either set the target attribute
to that window's name. If it has no name, we create a new, random, name
and assign it to both the target attribute and the window's name.

Warning, untested code. I did test that you can set the window's name
dynamically in Opera 7, Mozilla and IE 6.

This will probably fail if the user has navigated the original window
away from your pages and onto a new domain.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

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

Similar topics

2
by: Person | last post by:
I have a popup window with a form: The popup window is opened like this: <SCRIPT LANGUAGE=javascript> window.open('primos.html', 'primos', config='height=300, width=400') </SCRIPT> The...
7
by: Alex Hunsley | last post by:
I'm aware of how to access the document model in Javascript in order to do things like change the values in the fields forms. However, I'd like to pop up a helper window seperate from the page...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
2
by: Smith John | last post by:
Questions is related to ASP.Net (in VB.Net). How to replicate the modal behaviour of desktop application in ASP.Net application. Thanks, Smith John
3
by: michael | last post by:
let me keep it clean, quick and simple. I am passing a variable into another window and am reassigning the value on the new page - window.document...value = opener.document. ....value and...
13
by: salad | last post by:
Hi Guys: I was stuck. I needed to send a report to a file. My beautiful report(s) in Access were going to require loss of formatting with RTFs, a PITA in WordMailMerge, sending it as a text...
4
by: jwlum | last post by:
I have the following problem under Internet Explorer only: 1. User fills out form data (myform.php) and clicks a button that fires myFunction() 2. myFunction() spawns a "hello, world" popup page...
3
by: simora | last post by:
Hi: Need some working sample code to post hidden form data from a php page to a new popup window. 540 x 500 centered. The popup that I'm calling already is formatted and has a TITLE:web-2007.php...
11
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. ...
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:
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...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.