Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit form to pop-up with two buttons

Status
Not open for further replies.

MSRez

Programmer
Dec 22, 2004
57
EU
I have two buttons in a form and I would like to have one of them submit the form into a pop-up window and the other to submit the form normally.

Is this possible?
 
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]

<html>
<head>
<title>untitled</title>
<script type="text/javascript" language="javascript">

var prevWin = null;

function open_prevWin(oForm)
{
if (prevWin && !prevWin.closed)
prevWin.close();
oForm.action = 'preview.php';
prevWin = window.open('about:blank', 'prevWin', 'left=200,top=200,width=500,height=400,status=0'); //remove spaces above! (courtesy of this board)
if (prevWin && !prevWin.closed)
prevWin.focus();
return true;
}

function insert_submit(oForm)
{
oForm.action = 'insert_write.php';
oForm.target = '_self';
return true;
}

</script>
</head>
<body>
<form name="input" action="insert_write.php" method="POST" target="prevWin">
<textarea name="titolo" cols="30" rows="2" class="form"></textarea>
<INPUT type="submit" value="preview" name="A" onclick="return open_prevWin(this.form)">
<INPUT type="submit" value="insert" name="B" onclick="return insert_submit(this.form)">
<input type=reset value="Clear form" name="reset">
</p>
</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top