473,788 Members | 2,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copy popupwindow elements to opener

Hi,

I have a html form which is created by a cgi-script which sometimes
opens a popup window. This popup window reads it's content from a hidden
field in the openers form and writes it through document.write. The
content of this popup itself can also be small forms for example a
couple of radio button or textfields or things like that and every popup
has it's own "save" button,

When the user clicks "save" I have to read all the form elements in the
popup window and attach it to the window.opener form before submitting
that and closing the popup because I still need all the values from the
opener form plus the additional form fields from the popup.

I already tried looping through all the form elements and adding them
through appendChild to the opener. Problem is this crashes IE6 right
after it says "interface not supported", it works on Firefox 1.0 but it
must work on both browsers. I also tried to somehow clone the form
elements and then adding these clones to the parent, but you can't clone
form elements because you get a recursion too deep, because they are
linked to superclass objects, and therefore when you try to clone a form
object you end up in a loop. for example
document.forms. form.myfield.fo rm.myfield.form .myfield.form.. .. and so on

Does anyone have a solution how I can add these form values to my parent
window before submitting it?? Any ideas are welcome.

Marc
Jul 23 '05 #1
2 2387
Lee
Marc Elser said:

Hi,

I have a html form which is created by a cgi-script which sometimes
opens a popup window. This popup window reads it's content from a hidden
field in the openers form and writes it through document.write. The
content of this popup itself can also be small forms for example a
couple of radio button or textfields or things like that and every popup
has it's own "save" button,

When the user clicks "save" I have to read all the form elements in the
popup window and attach it to the window.opener form before submitting
that and closing the popup because I still need all the values from the
opener form plus the additional form fields from the popup.


You're creating the form with CGI, so you can simply add all of the
form controls that you need when you create it, then you only have to
set the values from the popup window.

Jul 23 '05 #2
Lee wrote:

You're creating the form with CGI, so you can simply add all of the
form controls that you need when you create it, then you only have to
set the values from the popup window.

Well it's not that simple. The content of the popup is totally dynamic
and created elsewhere in the program and then only attached to the
bottom of the html form.

Because of that the form parsing in the popup would of totally dynamic
forms is quite difficult to parse when it comes to certain form field
types. For example to detect which radio button was selected out of a
group of three. Because when looping through the form fields you would
have to detect which radio button elements belong together and which was
selected in order to set this value in the openers form, or for example
parse which options we're selected in a multiselect element.

The difficulty is not how to set the form fields in the opener, the
difficulty is how to parse the popup's form. once you know the name and
value of an element you can append it to the opener using the
"appendChil d" javascript function.

To overcome this parsing I thought that maybe there's a possibility to
clone or copy the form elements and then adding them to the opener. But
unlike java javascript has no support of cloning objects and the
javascript example I found for cloning object we're not able to clone a
html form object correctly so that you could add them with appendChild.
Jul 23 '05 #3

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

Similar topics

5
6607
by: Diana Coppenbarger | last post by:
Hi, I have a calendar program that is popped up by a HTML so that the user can choose a specific date to be filled in via javascript from the calendar program. I am using window.open() to start the calendar program and then calling my own function "javascript:opener.setDate()" to set the date back on the main window. This all works fine if I use the current month that is displayed, but as soon as I have to rebuild the calendar because...
4
6813
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 (typeof(opener.opener)=="object") { alert("1");
2
1519
by: Kåre Rasmussen | last post by:
Hi all I´m using a javascript based popupwindow in a webcalculation program. Once the calculation is done, and the result has been showen in the popupwindow, the user is able to go back to the webpage and ajust some of the values and press "calculate" again. Once´s the user does that, I would like the popupwindow (which is minimize) to maximize. I´ve tryed window.resizeTo(), but it didn´t help, so are there any other ways to maximize...
2
3129
by: nick | last post by:
I have the following code: var w=window.open('popup.htm','','width=400,height=400'); w.opener = this; var img = w.document.getElementById('pic'); However, the img variable is always null in Mozilla Firefox. But it works well in IE.
19
31072
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). The problem is that after the reload, it brings you right to the top of the page. When I click 'refresh" on the original page, it brings me back to the original viewing position. Is there a way to duplicate this in from the popup window. Also,...
4
13582
by: ioneabu | last post by:
The below function attempts to remove the contents of one form and replace with the contents of another. Is this not possible? Why not? It will make a big difference in the final solution to a problem I am trying to solve. Thanks for any advice! wana
4
52311
by: fperfect13 | last post by:
Hi, I wanted to perform a deep copy of an array. Searching on google I ran into different opinions : C# Interview Questions (http://blogs.wwwcoder.com/tsvmadhav/archive/2005/04/08/2882.aspx) 10.What's the difference between the System.Array.CopyTo() and System.Array.Clone()?
5
7535
by: asadhkhan | last post by:
I have the following code which works correctly in IE 6, but in IE 7, Fire Fox 2.0 and Netscape 8 it does not work. I have a main page where a button calls this pop-up and uploads a file once you click the attach it should upload file and close the window and send back control to Main page.. But it is not happening.. CODE: ========= <script LANGUAGE="JavaScript"> if ((window.opener != null) && (! window.opener.closed)) {
7
5334
by: markrandolph | last post by:
I have parent.htm and child.htm ================================================================= In parent.htm we have: var parentarray = new Array(5) window.open("child.htm",.....) ================================================================= In child.htm I want to add new elements to parentarray, like opener.parentarray = .......
0
10370
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10113
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
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 we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.