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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to submit a form in Frame B with a button in Frame A using FireFox

Status
Not open for further replies.

FvS

Programmer
Apr 5, 2006
20
NL
Hi all,

I have to frames:
And in FrameA i have the following link:

function submitform() {
if ( parent.frames.service.document.bodyinvoer.onsubmit())
{
parent.frames.service.document.bodyinvoer.submit();
}
}
<a href="javascript:submitform()">Submit</a>

This link works perfectly in IE it first runs het onsubmit handler and checks the forms and if it's ok it submit's the form, but in Firefox nothing happens[/color red] What am i doing wrong?
 
My single syllabic element names might displease a lot.

[1] frameset file
[tt]
<!-- frameset htm file -->
<html>
<frameset rows="50%,50%">
<frame name="x" src="f1.htm">
<frame name="y" src="f2.htm">
</frameset>
</html>[/tt]

[2] f1.htm[tt]

<!-- f1.htm -->
<html>
<body>
<!-- case with onsubmit handler -->
<form name="f" method="get" onsubmit="alert(this.q.value); if (this.q.value!=''){return true;} else {return false};" action="<input type="text" name="q" />
</form>
</body>
</html>[/tt]

[3] f2.htm[tt]

<!-- f2.htm -->
<html>
<head>
<script language="javascript">
//mimic op's function
function submitform() {
if ( top.frames['x'].document.forms['f'].onsubmit ) {
var b=top.frames['x'].document.forms['f'].onsubmit();
if (b) {
top.frames['x'].document.forms['f'].submit();
}
}
}
</script>
</head>
<body>
<button onclick="top.x.document.f.q.value='tek-tips.com';">add a value</button><br />
<a href="javascript:submitform()">Submit it</a><br />
</body>
</html>
[/tt]
I use top rather than parent. Practically the same.
 
Hi tsuji,

I found it!!

The thing that caused my problem is the following, within the
Code:
<script></script>
tags i used a safety net like:
Code:
<script>
<!-- [COLOR=red]shields up[/color red]
function checkform() 
  { return true }
 [COLOR=red]shields down[/color red] -->
</script>

I discovered an integrated tool in Firefox who checks you're javascript syntax and this gave a warning on the comment shields up shields down. After removing the text leaving only <!-- --> it works perfectly.

Thanks for al youre effort!!
 
I remember some even script a "shield" within functions as a legitimate ritual... that's pseudo-professional... and kind of fashion... Also as x... comes in, you further "shield" up with CDATA... Just my personal opinions, most others do not agree. Glad you get your way sorted out!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top