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!

Submitting an <IFrame>

Status
Not open for further replies.

ronsig

Programmer
May 24, 2001
54
IL
Hello everyone!

Is there a way to have an iframe submit without the surrounding page getting replaced as well?

Also, I'm having a problem submitting a form within the iframe: there's a form ("form2") within the page loaded to the iframe("iframe_obg"), but when I try to submit it it fails.

I've tried
document.form1.iframe_obj.form2.submit();
and
document.getElementById('iframe_obj').form2.submit();
and both fail

Is this even possible?

Thanks,
Ron
 
All you should have to do is document.submit(), I use iframes through out my Intranet site without any problems.

an Iframe is a inline frame (I believe, although not sure, that only IE supports it).
 
"All you should have to do is document.submit()"

From where? I don't wanty the entire page to submit, just the iframe.
And the "submit" button is outside the iframe
 
hey

this is what you do here is the code for the iframe below and just change and add your certain characteristics

<IFRAME src=&quot;page.html&quot; name=&quot;iframe1&quot; width=&quot;345&quot; height=&quot;893&quot;>

and to open the page in your iframe insert the following code as the link

<a href=&quot;page2.html&quot; target=iframe1>Linked Text</a>


hope this helped
ciao
 
<form target=&quot;...(the iframe's own name or id)&quot;>
... Coding is the worst thing I had done.
 
If your form is contained in the Iframe then use document.submit(). If its not, in the form tag I think you can use the target=&quot;IFRAMENAME&quot;, but I'm not sure, anyone else have a thought?

 
Page1.html:
Code:
<HTML><head>
<script id=clientEventHandlersJS language=javascript>
<!--
function cmdGo_onclick() {
    window.frames.ifrMyIFrame.document.frmMyForm.submit();
}
//-->
</script>
</head>
<Body>
<Form>
<input type=button id=&quot;cmdGo&quot; value=&quot;Go&quot; language=javascript onclick=&quot;return cmdGo_onclick();&quot;>
<IFRAME id=&quot;ifrMyIFrame&quot; Src=&quot;Page2.html&quot;></IFRAME>
</Form>
</HTML>

Page2.html:
Code:
<html>
<body>
<form id=&quot;frmMyForm&quot; Name=&quot;frmMyForm&quot; action=&quot;Page3.html&quot;>
This is Page 2
</form>
</body>
</html>

Page3.html:
Code:
<html>
<body>
<form id=&quot;frmMyForm&quot; Name=&quot;frmMyForm&quot; action=&quot;Page2.html&quot;>
This is Page 3
</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top