• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1112
  • Last Modified:

firefox form in frame

Hi,

I have to send data from one frame to another frame form, no problem in
IE, in Firefox tring to use: document.getElementById("frame ID").contentWindow.document.name_of_form.name_of_field...
get error "document.getElementById("frame ID")" has no property, where is the error?

Thank you,

Grig.
0
grig
Asked:
grig
  • 6
  • 6
1 Solution
 
justinbilligCommented:
Well this could be one of two things

either ... the id property doesn't accept id's with spaces .. so you have to have frame_ID as the id


or ....

if id property does accept spaces you don't have quotes around the id ... id=frame id  would cause problems ...

try either

id="frame_ID"

or

id="frame ID"
0
 
grigAuthor Commented:
it was just example, sorry, this is real program line:

tt=document.getElementById("hide").contentWindow.document.form_bot.weeks.value
0
 
nschaferCommented:
Hi grig,

I generally use this format

  tt = window.frames[0].document.form_bot.weeks.value;
 
Perhaps that will work better for you.

Neal.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
grigAuthor Commented:
Thank you Neal,
what is frames[0]. here?
0
 
nschaferCommented:
window.frames is a collection of all the frames on the page.  frames[0] specifies the first frame.  When working with iframes, the first iframe defined on a page will be 0 the second will be 1 and so on.

When working with framesets I'm fairly certain it would be a bit different, but if you just have a normal web page with an iframe in it the above is how it works.

Neal.
0
 
grigAuthor Commented:
do I have to switch to the page with Iframe then?
0
 
nschaferCommented:
I don't understand your question.

The code I posted would run in the parent page, not in the iframe page.

Neal.
0
 
grigAuthor Commented:
I dont have iframe, I use frameset...
0
 
nschaferCommented:
OK,  for some reason I thought you were using an iframe.  

here's how you can reference this from a frameset.

Lets assume I have the following frameset:

<FRAMESET ROWS="70%,30%" COLS="50%,50%">
  <FRAME NAME="frame1" SRC="test2.htm">
  <FRAME NAME="frame2" SRC="test3.htm">
</FRAMESET>

and I want to move data from Frame 1 to Frame 2

In Frame 2 I can reference Frame 1 like this:

  tt = parent.frames('frame1').document.form_bot.weeks.value;

Hope this helps,

Neal.

0
 
grigAuthor Commented:
Ye, it works fine, but only for IE, my question from begining - what I have to use for Mozilla browsers?
0
 
nschaferCommented:
Sorry a small change is required and then it works in IE, FF, Opera, and Netscape.

  tt = parent.frames['frame1'].document.form_bot.weeks.value;

Neal.
0
 
grigAuthor Commented:

Works in IE, in FF have:
Error: parent.frames.bottomFrame.document.form_bot has no properties
0
 
nschaferCommented:
OK, lets run a couple of tests.

comment out the above line and add in the following:

alert(parent.frames['bottomFrame'].document);
  When run in FF it should alert you with [object HTMLDocument]

if that works we'll go to the next setp

alert(parent.frames['bottomFrame'].document.form_bot);
  When run in FF it should alert you with [object HTMLFormElement]

I beleive that you will probably get undefined instead of [objectHTMLFormElement].  If so then we want to look at the form declaration, so post back your form tag.  <form name="form_bot" ...>

If you do get the appropriate result from the above alert then try the next step

alert(parent.frames['bottomFrame'].document.form_bot.weeks);
  When run in FF it should alert you with [object HTMLInputElement]

If all of these give you the appropriate results then it should be working.  Based on the error message you posted I believe the error resides in the Form Element, but this should verify that.

Neal.

 
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now