[Javascript] submit a form from another frame

anand anandkan at vsnl.net
Mon Aug 5 09:44:14 CDT 2002


hi

pl use the following in your menuFrame

<html>
<head>
<script language="javascript">
function doSubmit()
{
      if(parent.main1.document.mform.formChanged.value!="" )
      {
            alert(parent.main1.document.mform.name +" going to be
submitted");
            //alert("Form submit");
            parent.main1.document.mform.submit();
            alert('submit method invoked');
      }
}

</script>
</head>
<body>
<a href="javascript:doSubmit();">SUBMIT</a>
</body>
</html>

and this one in your contentFrame

<html>
<head>
<script language="javascript">
var formChanged=false;
function check()
{
	var tval=document.mform.mail.value;
	if(tval!="")
	{
		document.mform.formChanged.value="set";
		//formChanged=true;
	}

}
</script>
</head>
<body>
<form name="mform" method="post" action="topframe.html">
<input type="text" name="mail" value="" onChange="check()">
<input type="hidden" name="formChanged" value="">
<input type="button" value="submit" onClick="check()">
</form>
</body>
</html>

HTH

Mohan




More information about the Javascript mailing list