Solved

Passing data to IFRAME

Posted on 2003-10-30
6
383 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now