Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing data to IFRAME

Posted on 2003-10-30
6
Medium Priority
?
399 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 

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 600 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

704 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