[thelist] Window targeting problem

Aylard James J jaylard at equilon.com
Mon, 17 Jan 2000 10:34:31 -0600


Keith,

> The important thing is to guarantee that the
> window is opened and given an HTML window hierarchy name on 
> each submit
> BEFORE the form is submitted. This cannot be accomplished with the
> onsubmit method since the window.open occurs AFTER the submission has
> taken place and returned a true condition.

Actually, I've used the onsubmit method quite successfully to open a new
window as a target for a form. If you think about it, if onsubmit didn't
complete its work before actually submitting the form it would be useless
for form validation. The following example, though worthlessly simple, will
work in at least Nav3+ and IE3+.

<html>
<head>
<script language="javascript" type="text/javascript">
  <!--
    function fnProcessForm() {
      window.open("","MyWin") ;
    }
  // -->
</script>
</head>
<body>
<form 
  name="MyForm" 
  method="post" 
  action="Results.asp" 
  target="MyWin"
  onsubmit="fnProcessForm();">
  <input type="submit">
</form>
</body>
</html>

James Aylard
Equilon Enterprises LLC
jaylard@equilon.com