Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing a field value from a pop-up

Status
Not open for further replies.

shmmeee

Programmer
Apr 17, 2001
104
GB
Hi,
I've seen a couple of posts relating to window.opener and fields but none of the methods tried solve my problem so:

I've got a hidden field:
Code:
<input type=&quot;hidden&quot; name=&quot;PGText&quot; value =&quot;&quot;>

I add to the value of this field at various points. I have a link on my page that opens a blank pop-up window. I then write to this window using javascript. Including a line making another link that should open an alert box with the value of the hidden field (on the parent page). The resulting link in the pop-up looks like this:

Code:
<a href='#' onClick='javascript: alert(window.opener.document.forms[&quot;h_PageUI&quot;].PGText.value); return false;'>2</a>&quot;;

If I click this link I get an error: &quot;window.opener.document.forms.h_PageUI.PGText.value is not an object&quot;

However, if I just reference the form(window.....h_PageUI) then it returns [object] and if I leave off the '.value' at the end (window......h_PageUI.PGText) I get &quot;undefined&quot;.

So my question is, can you see anything wrong? Also Why does the error only occur when I try to get the value of the field, I must be referencing it correctly because I recognises the form (h_PageUI).

Any ideas?

TIA,
Iain X-)
 
Never mind, I've done it using window.opener.fieldName.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top