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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing window.opener'd fields

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
0
0
GB

I have got one main window that i am using to open up a secondary window when a user clicks a button. I want to be able to access the form fields on the first page from the secondary page. I don't really want to put any information onto a URL to this secondary page.

Is there a way of accessing the formfields from the first page on the secondary page?

I have in the past used the window.opener command to do a couple of things but i can't seem to find anything that shows how to achieve the above

any ideas?

Tony
 
yep, just use window.opener -- ie:
Code:
window.opener.document.forms[0].minput.value
would refer to the value of the field "minput" on the main page.

hope it helps "Those who dare to fail miserably can achieve greatly." - Robert F. Kennedy
So true..
 
Have you tried

window.opener.document.forms[0].elements[0].value ?
 
cheers guys for both of your comments.

I did try something like what you are both saying above and didn't get anywhere. guess that i was just doing something wrong.

in the end i did the following:

var objWindow = window.opener;
numEles=objWindow.document.getElementById('DriverID').length;

thanks both of you for your help
 
why does document.forms[0].fieldname.value work but not document.formname.fieldname.value? How many software developers does it take to change a light bulb?
None: it works in everyone else’s office, it must work in yours too.
 
Hi bombboy,
I guess document.formname.fieldname.value should work like document.forms[0].fieldname.value except if you have two objects with same name as your formname on your page. Please verify it. hope it will help [bigcheeks] Experience teaches slowly and at the cost of mistakes [pipe]
 
Thanks raxg,
But I have. A thousand times, i've even cut and pasted to avoid typos. I keep getting, "opener.window.document.formname.fieldname" is null or not an object. How many software developers does it take to change a light bulb?
None: it works in everyone else’s office, it must work in yours too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top