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

return to main window after submit

I have popup window (window.open) where I put any value in input field.
After submit I wan to to return to the main window and get value from popup
window. How to close popup window and return to the main after submit?
Jul 23 '05 #1
1 3391
Piotr wrote:
I have popup window (window.open) where I put any value in input field. After submit I wan to to return to the main window and get value from popup window. How to close popup window and return to the main after

submit?

<html>
<head>
<title>Master Form Page</title>
<script type="text/javascript">

var Fwin = null;

function openFWin(url)
{
var w = 160,
h = 100,
l = 200,
t = 180;
Fwin =
open(url,'Fwin','width='+w+',height='+h+',left='+l +',top='+t+',status=0');
if (Fwin && !Fwin.closed)
Fwin.focus();
return false;
}

</script>
</head>
<body onload="document.mainform.reset()">
<form name="mainform">
<input name="data" type="text" /><a href="#" onclick="return
openFWin('formpop.html')">&larr;set data</a>
</form>
</body>
</html>

[formpop.html]

<html>
<head>
<title>Pop Up Form</title>
<script type="text/javascript">

function transfer_to_opener(oSrcForm, sDestFormName)
{
if (opener && !opener.closed)
{
var f, els;
if ((f = opener.document.forms[sDestFormName]) && (els = f.elements))
els['data'].value = oSrcForm.elements.data.value;
top.close();
return false;
}
}

</script>
</head>
<body bgcolor="#82a4c8" onblur="setTimeout('top.focus()', 100);">
<form name="popForm"
style="width:100%;text-align:center;padding-top:20px;"
onsubmit="return transfer_to_opener(this, 'mainform')">
<input name="data" type="text" value="enter data"
onfocus="this.value=''" />
<br /><br />
<input type="submit" value="done" />
</form>
</body>
</html>

This doesn't submit the new data, just transfers it over to the 'main'
window, a typical request. If you want the data submitted, remove
'top.close();' and 'return false;' from the function, and return an
action page to the pop-up with a bit of JS that closes the window
unconditionally.

Jul 23 '05 #2

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

Similar topics

3
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
5
by: Hemanth | last post by:
Hello there, I'm running a script that opens a popup window (which is basically a form with checkboxes and a submit button). When I click the submit button I want to run a PHP script and target...
2
by: Joe Erpenbeck | last post by:
On an asp.net page, when focus is in a text box and the user presses return, then a postback occurs and the first ImageButton on the page handles the event. I would prefer that nothing happens. I...
6
by: Mark Goldin | last post by:
I have main aspx page with a button that will show a modal dialog in the Browser when a user clicks on the button. On the modal form the user will do some selections. The he will submit his...
5
by: drdave | last post by:
Hi, I have 6 forms being generated using coldFusion, they are named special1, special2 special3 and so on.. in these forms I have a link to open a new window. I am trying to pickup the...
18
by: Seeker | last post by:
I essentially copied this program from K&R: #include <stdio.h> #include <stdlib.h> int main() { int c;
3
by: Anthony | last post by:
I have a form on a web page that requires to click on a button to submit the information. I have two questions about changing this form: 1. Is there a way that I can change the script so that the...
9
by: Tyler | last post by:
Hello All: I am currently working on a project to create an FEM model for school. I was thinking about using wxPython to gather the 12 input variables from the user, then, after pressing the...
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.