Submit form to new window

Giganews Newsgroups
Subject: Submit form to new window
Posted by:  teren…@parker.com.hk (Terence Parker)
Date: 16 Oct 2003

How does one go about submitting a form with a link - but submitting
it to a new window AND to a page different to that described within
the action="" option of the <form> tag?

Say, for example, I have a simple form such as the following:

<form method="POST" action="submit.php" name="AForm">
Name: <input type="text" name="Name" length="20"><br>
Age: 15 <a href="age.php">change age</a><br>
<input type="submit" name="submit" value="submit">
</form>

Clicking 'submit' will submit to 'submit.php' - but I want the link to
submit to 'age.php'.

This example is an oversimplification of what I want to do - yes, I
know that in the example above I don't NEED to submit a link into a
new window... But, it's an example.

I know one can use ONCLICK="document.formName.submit();return true;" -
but that submits to the same form defined in <form action> .

I know as well that I can use "onClick=window.open('link.php','Popup
Window','toolbar=no,
location=no,directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,copyhistory=no,width=500,height=500,top=20,left=
100')" (or something similar) to open a link to a new window.

But how do I combine the two - AND submit to a different location?

Basically, what i'm doing is one of those pages with customer
information - and for one of those choices I want to popup a new
window with a <select> . That submit will then send the data back to
the originating PHP page - and will reload it.

IDEALLY, I wouldn't even do it like this - just have javascript
replace the values on the originating page without reloading (and
resubmitting everything)... so if anyone knows how to do that, even
better!

Thanks,

Terence

Replies