Link to home
Start Free TrialLog in
Avatar of GaryZ
GaryZ

asked on

Passing data to IFRAME

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.

Avatar of VincentPuglia
VincentPuglia

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
Avatar of GaryZ

ASKER

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
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
Avatar of GaryZ

ASKER

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;        
}
ASKER CERTIFIED SOLUTION
Avatar of VincentPuglia
VincentPuglia

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GaryZ

ASKER

OK. Got it, thanks a lot.  It appears it was cached in IE 6.