[Javascript] submit a form from another frame

maciej.kaniewski at lido.net maciej.kaniewski at lido.net
Sun Aug 4 23:34:52 CDT 2002


Hi all,

I'm aware that there were a lot of topics on this list regarding submit
problem, but unfortunately I couldn't find a solution for my problem.

My webpage has a few frames. One of them is called "contentFrame". I've got
another one which is a menu frame.
Let's assume I want to have a hyperlink in my menu frame, which submits the
current page in the contentFrame (don't ask me why I want to have like
this. It a bit more complicated.)
My page which is loaded into the contentFrame has only one form, called
'contentForm'.
How can I do that?

My menu file is very simple

<html>
<head>
<script language="javascript">
function doSubmit()
{
      if( parent.contentFrame.formChanged )
      {
            alert(parent.contentFrame.document.forms[0].name ' is going to
be submitted');
            parent.contentFrame.document.forms[0].submit();
            alert('submit method invoked');
      }
}
</script>
</head>
<body>
<a href="javascript:doSubmit();">SUBMIT</a>
</body>
</html>

The reason why I have additional doSubmit method is to check if the form
has been changed or not (in fact to check if I need to submit or not).
Once I enter some value in the text input field in the contentForm, my
formChanged flag is set to true. THen if I click on SUBMIT hyperlink in the
menu frame, I can see the alert window with the text "contentForm is going
to be submitted" and then I have an JS error: "Object doesn't support this
property or method"
Why????????

Any suggestions are welcome
thanks in advance

Maciek





More information about the Javascript mailing list