I'm trying to make a popup to change a hidden (eventually) field in the main window.
I've got this:
The main window:
<HTML>
<HEAD>
<SCRIPT language="JavaScript" type="text/javascript">
self.name = "main"; // names current window as "main"
function showRemote()
{
var windowprops = "toolbar=0,location=0,directories=0,status=0, " + "menubar=0,scrollbars=0,resizable=0,width=150,height=200";
OpenWindow = window.open("remote.html", "remote", windowprops); // opens remote control
}
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<FORM>
<INPUT type="button" value=http://www.webdeveloper.com/forum/archive/index.php/"Open Remote Control" onClick="showRemote();">
</FORM>
<FORM action="main.php" method="POST" name="main_form" onsubmit="OpenWindow.remote_form.remote_field.value = this.main_field.value;">
<INPUT name="main_field" type="text" value=""/>
<INPUT name="Submit" type="submit" value="Submit"/>
</FORM>
</CENTER>
</BODY>
</HTML>
The popup:
<HTML>
<BODY bgcolor="#ffffcc">
Remote Control
<FORM name="remote_form" onsubmit="main.document.main_form.main_field.value = OpenWindow.remote_form.remote_field.value;">
<INPUT name="remote_field" type="text" value=""/>
<INPUT name="Submit" type="submit" value="Submit"/>
</FORM>
</BODY>
</HTML>
The example is online here:
<!-- m --><a class="postlink" href="http://www.roughdot.nl/test/JS/main.php">http://www.roughdot.nl/test/JS/main.php</a><!-- m -->
Javascript complains on both of the onsubmit attribs of the forms. I've made both of them interchanging (if the one is submitted, the other's field should be changed as well).
But neither is working
What am I doing wrong?
I've got this:
The main window:
<HTML>
<HEAD>
<SCRIPT language="JavaScript" type="text/javascript">
self.name = "main"; // names current window as "main"
function showRemote()
{
var windowprops = "toolbar=0,location=0,directories=0,status=0, " + "menubar=0,scrollbars=0,resizable=0,width=150,height=200";
OpenWindow = window.open("remote.html", "remote", windowprops); // opens remote control
}
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<FORM>
<INPUT type="button" value=http://www.webdeveloper.com/forum/archive/index.php/"Open Remote Control" onClick="showRemote();">
</FORM>
<FORM action="main.php" method="POST" name="main_form" onsubmit="OpenWindow.remote_form.remote_field.value = this.main_field.value;">
<INPUT name="main_field" type="text" value=""/>
<INPUT name="Submit" type="submit" value="Submit"/>
</FORM>
</CENTER>
</BODY>
</HTML>
The popup:
<HTML>
<BODY bgcolor="#ffffcc">
Remote Control
<FORM name="remote_form" onsubmit="main.document.main_form.main_field.value = OpenWindow.remote_form.remote_field.value;">
<INPUT name="remote_field" type="text" value=""/>
<INPUT name="Submit" type="submit" value="Submit"/>
</FORM>
</BODY>
</HTML>
The example is online here:
<!-- m --><a class="postlink" href="http://www.roughdot.nl/test/JS/main.php">http://www.roughdot.nl/test/JS/main.php</a><!-- m -->
Javascript complains on both of the onsubmit attribs of the forms. I've made both of them interchanging (if the one is submitted, the other's field should be changed as well).
But neither is working
What am I doing wrong?