I’m trying to determine how to refer to a response document in a frame. The frame displays documents created by a $$ViewTemplate with two forms - FormA and FormB. (Form B is for response docs.). The response doc is updated with the following code from a child window:
opener.parent.parent.frames[“RightFrame”].document.forms[1].FieldName.value = “This is a test.”;
I would therefore expect the following alert to return “This is a test.” when run from an action on the $$ViewTemplate. Instead, it returns a message saying that this is ‘null or not an object’.
alert(window.parent.frames[“RightFrame”].document.forms[1].FieldName.value);
I’d appreciate any ideas on how to refer to the document so that the FieldName value might be identified.
Thanks.
Subject: Referring to a Document in a Frame
I am not sure I am following the sequence of events and the layout of your frames. Butalert(window.frames[“RightFrame”].document.forms…etc should do the trick unless you have nested framesets
Anna
Subject: RE: Referring to a Document in a Frame
The following ‘alerts’ might better indicate what I’ve encountered. (I’ve also tried at least 30 other variations of these, but each returns an error.)
“alert(window.top.frames[1].document.location);” // returns http://host/database.nsf/FormB?CreateDocument
“alert(window.parent.frames[1].name);” // returns ‘RightFrame’
“alert(window.parent.frames[1].document.location);” // returns http://host/database.nsf/FormB?CreateDocument
“alert(window.parent.parent.frames[1].document.location);” // returns http://host/database.nsf/FormB?CreateDocument
“alert(window.top.parent.frames[1].document.location);” // returns http://host/database.nsf/FormB?CreateDocument
“alert(window.top.parent.frames[1].parent.document.location);” // returns http://host/database.nsf?OpenDatabase
Note that including ‘location’ in some of these ‘alerts’ returns ‘FormB’. For these, I expected that replacing ‘location’ with ‘forms[1].FieldName.value’ would return a valid value, but this has not been the case.
I’d appreciate any other ideas. Thanks.
Subject: RE: Referring to a Document in a Frame
Shane,
What does View Source give you when you look at the page where you are calling your alert from? I am assuming you have more than one form in that frame since you are using forms[1] and not forms[0].
Have you tried alert(window.parent.frames[1].document.all.FieldName.value ?
If you want you can email me a copy of the the results of View Source and I can better help you.
acdcinc at charter.net
Anna