October 24th, 2000, 02:35 PM
-
I'm writing a form - user clicks on a certain check box, which launches a pop-up windows asking for more information. They click the button, the window closes and the new information is passed back to the parent form. So far so good...
My problem is that in passing that info, it also re-loads the page, losing any input the user has made to that point. Since this form has 8-10 text boxes, @18 check boxes, and a couple comment fields, this will not work. I've been humpin' this for a couple of days now and am not making any headway. I could really use some help on this. Thanks loads in advance (the code I'm using is below)
[Initial page]
-------------------------------------------
<?
if($submit)
{
echo "TBS=$tbs<br>";
echo "Text1=$popText1<br>";
echo "Text2=$popText2<br>";
}
?>
<?
echo "Text1=$popText1<br>";
echo "Text2=$popText2<br>";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script language="javascript">
<!--
var myPopup = '';
var winl = (screen.width - 300) / 2;
var wint = (screen.height - 300) / 2;
document.write("width=300, top="+ wint +", left="+ winl);
function hotWin() {
if(document.mainForm.tbs.checked ==true)
{
myPopup = window.open("tbsPage.phtml","TBS_Info","width=300,height=300,top=" + wint + ",left=" + winl +",toolbar=0,location=0,menubar=0,scrollbars=0,resizable=0")
myPopup.opener = self;
}
}
// End -->
</script>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="mainForm">
Item 1
<input type="checkbox" name="tbs" value="1" onClick="hotWin()")>
<br>
<br>
<input type="submit" name="submit" value="Submit">
</form>
<FORM NAME="hiddenForm" ACTION="test.phtml">
<input type="hidden" name="popText1">
<input type="hidden" name="popText2">
</FORM>
</body>
</html>
[PopUp Page]
--------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="javascript">
<!--
function copyForm() {
opener.document.hiddenForm.popText1.value=document.popupForm.popText1.value;
opener.document.hiddenForm.popText2.value=document.popupForm.popText2.value;
opener.document.hiddenForm.submit();
window.close();
return false();
}
//-->
</script>
</head>
<body>
<form name="popupForm" onSubmit="return copyForm()";>
<input type="text" name="popText1">
<p>
<input type="text" name="popText2">
<br>
<input type="button" name="submit" value="Submit" onClick="copyForm()">
</form>
</body>
</html>
October 24th, 2000, 02:50 PM
-
Well if i understand it correctly
this is a javascript issue
and removing the following line
opener.document.hiddenForm.submit();
from the popup window will prevent the original form
from reloading, so all the input fields
will be un-altered
------------------
Greetings lewi