Solved

Passing data to IFRAME

Posted on 2003-10-30
6
386 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
  • 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

809 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