...

View Full Version : Submitting in another frame



arnyinc
06-07-2007, 08:37 PM
I have a main page and an iframe. I want to click a link on the main page, which submits a form contained in the iframe. This works in IE, but not Firefox. I don't receive any errors but it just ignores the form.submit() call.

Another note, it works in Firefox if I haven't called any other javascript functions prior to submitting.

mainpage.htm


<script language="javascript">
function saveItAll(){
document.forms[0].submit();
}
</script>

<a href="#" onclick="frames['MyIframe'].saveItAll()">


iframe.htm


<form name="test" action="process.php" method="post">
<input type="text" name="test1" id="test1">
</form>

glenngv
06-08-2007, 01:48 AM
I don't know why that works in IE. Based on your description, the code should be something like this:

mainpage.htm

<a href="#" onclick="window.frames['MyIframe'].saveItAll(); return false;">Submit</a>
<iframe name="MyIframe" src="iframe.htm"></iframe>

iframe.htm

<html>
<head>
<script type="text/javascript">
function saveItAll(){
document.forms[0].submit();
}
</script>
</head>
<body>
<form name="test" action="process.php" method="post">
<input type="text" name="test1" id="test1">
</form>
</body>
</html>

arnyinc
06-08-2007, 09:48 PM
Alright, thank you for the attempt. It doesn't seem to work though. I can do something as simple as:

alert(a);
myform.submit();
alert(b);

And it will actually display "a" and "b" but it won't submit the form. I've limited it down to a Firefox bug so I will submit it to them.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum