Solved

firefox form in frame

Posted on 2006-06-28
13
1,097 Views
Last Modified: 2012-08-14
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
Comment
Question by:grig
  • 6
  • 6
13 Comments
 
LVL 15

Expert Comment

by:justinbillig
ID: 17002977
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
 

Author Comment

by:grig
ID: 17003168
it was just example, sorry, this is real program line:

tt=document.getElementById("hide").contentWindow.document.form_bot.weeks.value
0
 
LVL 19

Expert Comment

by:nschafer
ID: 17004171
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
 

Author Comment

by:grig
ID: 17004378
Thank you Neal,
what is frames[0]. here?
0
 
LVL 19

Expert Comment

by:nschafer
ID: 17004397
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
 

Author Comment

by:grig
ID: 17004626
do I have to switch to the page with Iframe then?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 19

Expert Comment

by:nschafer
ID: 17004649
I don't understand your question.

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

Neal.
0
 

Author Comment

by:grig
ID: 17004947
I dont have iframe, I use frameset...
0
 
LVL 19

Expert Comment

by:nschafer
ID: 17006265
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
 

Author Comment

by:grig
ID: 17010922
Ye, it works fine, but only for IE, my question from begining - what I have to use for Mozilla browsers?
0
 
LVL 19

Expert Comment

by:nschafer
ID: 17011030
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
 

Author Comment

by:grig
ID: 17011153

Works in IE, in FF have:
Error: parent.frames.bottomFrame.document.form_bot has no properties
0
 
LVL 19

Accepted Solution

by:
nschafer earned 125 total points
ID: 17011439
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now