djm0219
03-28-2009, 09:10 PM
Given the page below I'm trying to have Button 2 submit the form but have the submit and subsequent processing be done in a new page/tab.
The small bit of JavaScript works correctly to open a new page/tab but the form values don't appear to be available in the new page/tab nor does the new page/tab know that Button 2 was pressed.
Is there a method of having a form from a page, along with all of its values and the button that was pressed, available on a new page/tab?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>Form Test</title>
<script type="text/javascript">
function Print_Selected(TheForm) {
PrintWin = window.open(document.getElementById(TheForm).action,'_blank');
PrintWin.focus();
}
</script>
</head>
<body>
<form action="FormTest.php" method="post" id="testform">
<p><input type="submit" name="button1" id="button1" value="Button 1"/>
<input onclick="Print_Selected('testform');return(false);" type="submit" name="button2" id="button2" value="Button 2" /></p>
<p>
<input type="checkbox" name="box1" value="box1" />CheckBox 1
<input type="checkbox" name="box2" value="box2" />CheckBox 2
</p>
</form>
</body>
</html>
FWIW this is a small part of a much larger application and the form and processing are all handled with PHP but the problem is really a basic HTML problem that isn't related to PHP.
The small bit of JavaScript works correctly to open a new page/tab but the form values don't appear to be available in the new page/tab nor does the new page/tab know that Button 2 was pressed.
Is there a method of having a form from a page, along with all of its values and the button that was pressed, available on a new page/tab?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>Form Test</title>
<script type="text/javascript">
function Print_Selected(TheForm) {
PrintWin = window.open(document.getElementById(TheForm).action,'_blank');
PrintWin.focus();
}
</script>
</head>
<body>
<form action="FormTest.php" method="post" id="testform">
<p><input type="submit" name="button1" id="button1" value="Button 1"/>
<input onclick="Print_Selected('testform');return(false);" type="submit" name="button2" id="button2" value="Button 2" /></p>
<p>
<input type="checkbox" name="box1" value="box1" />CheckBox 1
<input type="checkbox" name="box2" value="box2" />CheckBox 2
</p>
</form>
</body>
</html>
FWIW this is a small part of a much larger application and the form and processing are all handled with PHP but the problem is really a basic HTML problem that isn't related to PHP.