I’m new at javascripting and am trying to submit a form after it has been validated via javascript. I am trying to pass the input info to a popup window but instead get a whole browser window.
Here’e my code, thanks for your help.
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
<title> New Document </title>
<script type=”text/javascript” language=”JavaScript”>
<!–
function checkContents(theForm)
{
if (theForm.name.value == “”)
{
alert(“Please enter a name.”);
}
else if (theForm.weight.value == “”)
{
alert(“Please assign a weight.”);
}
else
{
theForm.submit();
}
}
function popWindow(wName){
features =
‘width=400,height=400,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,r
esizable=no’;
pop = window.open(”,wName,features);
if(pop.focus){ pop.focus(); }
return true;
}
–>
</script>
</head>
<body>
<form name=”edititem” action=”popup2.php” method=”post” target=”Details” onSubmit=”return
popWindow(this.target)”>
<input type=”hidden” name =”weight” value=”172″>
<input type=”hidden” name=”name” value=”John”>
<!–<input type=”submit” value=”John”>–>
<input type=”button” value=”Edit Item” onClick=”checkContents(edititem)”>
</form>
</body>
</html>