473,588 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

windows / DOM referencing problems... please help...


Folks,

Windows, and refering to them (be they in seperate frames or in a popup)
always catch me... There is parent, top, self, the name of the window
itself and where it sits when refering to its full property name... It
drives me up the wall that I can't get this right after six months or so...

Before someone gives me a spiel on not using popups:

1) It is for an intranet LAMP based application and
2) Popups are not automatic but instead requested
via a properly labeled button/link
3) My end user environment permits popups from my domain.

The question in short format:
How can a child window call a function that exists in a parent window to
read values from the child window and copy to the parent?

Longer question with more meat on the bones:
Two windows - one we call father (the parent) and the popup we'll call kid.

I have a value that is selected in the kid window that needs copying to
the parent/father window.

This is easy enough if the javascript is contained in the child/kid
window but not if my javascript is called from the parent window.

I know for example, I can have a function in the father/parent window
called testone(). I know the child can call this function using
window.opener.t estone(); but how do I have this function refer to a
field in the kid/child window?

Roughly speaking, I've tried the following:

parent/father window contains following script:

function testone()
{ alert(kid.docum ent.formName.fi eldname.value);
return true;
}
child/kid window has the following onClick event on the submit button
onClick="return window.opener.t estone();"

If my 'alert()' function call in test one is set to "hello" - it works -
but if I ask it to give me tthe value of a form field in the popup
window called formFieldname - it tells me that
kid.document.fo rmName.fieldnam e.value has no properties...

I believe the problem I am having is beacuse the script sits in the
parent window and its being called from the child - and I'm muddling up
the window references on how one see's the other.

Can someone help me? All help, via the newsgroup is much appreciated.

Thanks
Randell D.
Jul 23 '05 #1
2 1596
On Sun, 18 Apr 2004 01:39:40 GMT, Reply Via Newsgroup
<re************ ****@please.com > wrote:

[snip]
If my 'alert()' function call in test one is set to "hello" - it works -
but if I ask it to give me tthe value of a form field in the popup
window called formFieldname - it tells me that
kid.document.fo rmName.fieldnam e.value has no properties...
Have you actually determined which object is undefined (if it's not
explicitly stated in the message)? That is, have you tried

alert( kid );

then

alert( kid.document );

and so on until you get "undefined" displayed?
I believe the problem I am having is beacuse the script sits in the
parent window and its being called from the child - and I'm muddling up
the window references on how one see's the other.
I would think that the simplest solution would be to pass references to
the function during the call, then it wouldn't matter where the elements
are located. For example:

<button type="submit" onclick="return opener.testone( this.form)"Submit</button>


function testone( form ) {
alert( form.fieldname. value );
// ...
}

Of course, this depends on the functions you're designing, what data
they're accessing, and the architecture of the site.

Good luck,
Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2
Michael Winter wrote:
On Sun, 18 Apr 2004 01:39:40 GMT, Reply Via Newsgroup
<re************ ****@please.com > wrote:

[snip]
If my 'alert()' function call in test one is set to "hello" - it works
- but if I ask it to give me tthe value of a form field in the popup
window called formFieldname - it tells me that
kid.document.fo rmName.fieldnam e.value has no properties...

Have you actually determined which object is undefined (if it's not
explicitly stated in the message)? That is, have you tried

alert( kid );

then

alert( kid.document );

and so on until you get "undefined" displayed?
I believe the problem I am having is beacuse the script sits in the
parent window and its being called from the child - and I'm muddling
up the window references on how one see's the other.

I would think that the simplest solution would be to pass references to
the function during the call, then it wouldn't matter where the elements
are located. For example:

<button type="submit" onclick="return opener.testone( this.form)"
>Submit</button>


function testone( form ) {
alert( form.fieldname. value );
// ...
}

Of course, this depends on the functions you're designing, what data
they're accessing, and the architecture of the site.

Good luck,
Mike


Thanks... I am using Mozilla and its javascript debugger didn't give me
enough to go on... However I'll try 'walking' true the object like you
suggested... My alternative solution is to have the child/kid window
have the script inline (as opposed to calling it from the parent/father
window). Its a short small script...

As always though, thanks for your help,
randell d.
Jul 23 '05 #3

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

Similar topics

16
34546
by: Robert Mark Bram | last post by:
Hi All! Is there a way to reference a window by name without doing something like this: open (, 'windowName'); The open method will open a blank window if there is no window with such a name. I am trying to organise a navigation structure between two windows with content from the same host.. I have been trying the following:
3
1943
by: Morten Thorsen | last post by:
Hi frame experts c",) Hope you can help me out on this one I've got a frameset (index.html) on my server (server A) defining two frames. Left frame is named "menu" and contains a page (menu.html) which is located on the same server while right frame is named "main" and contains a page (main.html) which is located on another server (server B). This page has a form named "f" with an element named "id". I want to access/read the value of...
0
838
by: Le9569 | last post by:
Good morning, all. I have a web application that hosts in windows 2000. Now I want to move to new web server using windows 2003. The problem is the application is referencing some .dll files under WinNT\Microsoft.NET\framework\... In the new windows 2003, it uses the different name as WINDOWS\Microsoft.NET\framework\... Is the a tool to change it automatically or how do I change it manually?
10
3472
by: Ger | last post by:
I am having problems using VB.Net's Management base object on a machine hosting Windows Server 2003. I am trying to set file permissions from a Windows Service. These files may be loacted on a local machine or somewhere on the network. I use the Management Base Object to set these permissions which works perfectly when the windows service is running on an XP machine. However, when the service is running on a Windows Server 2003 machine I...
3
7477
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work on her local machine. Everything looks pretty good. OpenLDAP/cygwin works great. PostgreSQL works great. Apache runs. PHP runs. But when I try to connect to my PostgreSQL server using PHPPgAdmin, I
3
4675
by: bsturg21 | last post by:
Hello, I have a windows form that has a series of linklabels on it, and I need to have each linklabel, when clicked, open a separate windows form that has a single paramter passed into it. The form that has the System.Windows.Forms.LinkLabel controls on it is in a different project and under a different namespace from the file where the LinkLabel_LinkClicked events are, so I can't just do frm.ShowDialog under the LinkClicked method. ...
1
1840
by: =?Utf-8?B?ZHVjaG92bGV0?= | last post by:
I tried installing Norton SystemWorks Premier 2007 onto my new laptop which is running Windows XP SP3 Home Edition. The installation SEEMED to go ok but then when I tried doing the initial LiveUpdate I ran into a host of problems. I will explain all below and hopefully someone can point me in the right direction. FYI: this is my very first post to the MS Community discussion groups so bare with me and give me any explanation in layman...
0
9199
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Description NOTE- If you are unfamiliar with the concept of autoruns, then read "Windows Autorun FAQs: Overview". Que-1: How can I safely remove or edit the autorun settings on my PC? Ans: I recommend that you backup all of your important data before trying anything mentioned in this article. When a person is tweaking with autoruns, one has to rely on 'trial and error' methods and so there is always the possibility...
0
7929
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8228
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...
0
8357
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7987
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,...
1
5729
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
3847
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
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
0
1196
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.