Hello,
I have a page (warning2.html) that is loaded via a PHP script. When the page loads, a popup box/confirm dialog appears. If 'Cancel' is pressed I want the page to do nothing (just disappear). And if 'Ok' is pressed I want the page to submit an HTML form. Here is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>warning</title>
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
</head>
<body onload="confirmAdd()">
<form name="myForm" id="myForm" action="" method="post">
<input type="hidden" name="gradname" value="<?php echo $_POST['gradname']; ?>" />
<input type="hidden" name="research" value="<?php echo $_POST['research']; ?>" />
<input type="hidden" name="showAllMeetings" value="<?php echo $_POST['showAllMeetings']; ?>" />
<input type="hidden" name="time" value="<?php echo $_POST['time']; ?>" />
<input type="hidden" name="addConfirm" value="yes" />
</form>
<script type="text/javascript">
function confirmAdd()
{
var conf = confirm("You already have a meeting scheduled for <?php echo $_POST['time']; ?>. Continue anyway?");
if(conf == true)
{
// Submit form to add meeting
document.myForm.submit();
}
else
{
// Do nothing
}
}
</script>
</body>
</html>
This code seems to work fine, except the form doesn't seem to be submitted when I click 'Ok' (conf = true).
Please let me know what I can do.
Thanks,
Twin