Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

submit form from one frame, display in another

Status
Not open for further replies.

SarahKate31

Programmer
Feb 14, 2002
34
US
hi everyone -
i saw a post similar to this one, but it didn't really answer my question, so i posted this one...

i have a frameset with 3 frames (one hidden)...summary.htm is initially loaded into the "main" frame. this page has links that will let you view different reports. when you click on the link, I would like to load that report using submit() into the "rpt" frame and NOT into the "main" frame. i have the following function that is attached to the onClick event for the links and right now it is loading the report into both frames. I need to leave the existing page in "main" and only load the report in "rpt"...


index.htm-->
<frameset rows="0%,50%,50%" border="0" frameSpacing="0" frameBorder="0" id="LKQFrames">
<frame name="data" src="data.htm" scrolling="no" noresize>
<frame name="main" src="summary.htm" scrolling="no">
<frame name="rpt" src="report.htm" scrolling="no">
</frameset>

summary.htm -->
<html>
<head>
<script language="javascript">


function RunReport(rptName) {
window.parent.data.Name=document.SumForm.txtName.value
window.parent.data.Date=document.SumForm.txtDate.value
window.parent.data.Age=document.SumForm.txtAge.value

if(rptName=="Report1") page="Report1.htm"
if(rptName=="Report2") page="Report2.htm"
if(rptName=="Report3") page="Report3.htm"

window.parent.rpt.src=page
document.SumForm.action=page
document.SumForm.submit()
}
</script>
</head>
<body>
<form action="" method=post id=SumForm name=SumForm>
<table>
<tr>
<td><input type=text id=txtName></td>
<td><input type=text id=txtDate></td>
<td><input type=text id=txtAge></td>
</tr>
<tr>
<td><A href="javascript:eek:nclick=RunReport('Report1')>Report 1</A></TD>
<td><A href="javascript:eek:nclick=RunReport('Report2')>Report 2</A></TD>
<td><A href="javascript:eek:nclick=RunReport('Report3')>Report 3</A></TD>
</tr>
</table>
</form>
</body>
</html>


if anyone can help out, i'd really appriciate it!
thanks, kate
 
Just add target="rpt" to the <FORM> tag/

Adam

There are only 10 types of people in the world: Those who understand binary, and those who don't
 
adding target="rpt" is working, but is there a way to do it without opening up a new window? and just have the rpt frame display in the bottom half of the current window?

thanks, kate
 
It should've loaded in rpt. Are you sure the target name and frame name match exactly and that the "rpt" frame exists at the time you submit the form?

Adam

There are only 10 types of people in the world: Those who understand binary, and those who don't
 
right you are - my mistake... thanks so much for your help - i really appriciate it :)

--kate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top