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

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 6531
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. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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...
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,...

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.