Solved

Passing data to IFRAME

Posted on 2003-10-30
6
391 Views
Last Modified: 2008-03-03
I have the following code on a form to open an IFRAME

<IFRAME id=iframe_class name=iframe_class src="f2.html" scrolling = "auto" style="width:80%;height:350;position:bottom;left:10;z-index:5;display:none"></iframe>

I can pass the data from the IFRAME back to the form, but I can't get data from the form to pass to the IFRAME.

0
Comment
Question by:GaryZ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9650932
dependent upon where:

iframe_class.document.formname.fieldname.value = something
frames['iframe_class'].document.formname.fieldname.value = something
iframe_class.globalVarname = something

more info would help
Vinny
0
 

Author Comment

by:GaryZ
ID: 9651019
What additional information do you need?

f1.html is the main form and has a field called  f1_risk

f2.html is the Iframe and has a field called f2_risk

When a user clicks on a button I do the following:

document.getElementById('iframe_class').style.display='inline';

I also want to populate f2_risk with the value in f1_risk
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9651115
iframe_class.document.formname.f2_risk.value = document.formname.f1_risk.value;

change the 'formname'(s) to whatever the forms names are.

else if each form is the first within the respective pages:

iframe_class.document.forms[0].f2_risk.value = document.forms[0].f1_risk.value;


Vinny
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:GaryZ
ID: 9651340
I tried the following but I get a syntax error on the IF.  Since the IFRAME is hidden on the load of the form, I need to check to see if the field is available.


if(iframe_class.document._V2_F2.F2_Risk_1)
{
     iframe_class.document._V2_F2.F2_Risk_1.value = document._F1.F2_RiskType1.value;        
}
0
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 150 total points
ID: 9651414
Hi Gary,

  since it works for me when hidden & visible...hidden in what manner? what sort of an error?  what browser?

Vinny
0
 

Author Comment

by:GaryZ
ID: 9651763
OK. Got it, thanks a lot.  It appears it was cached in IE 6.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

710 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