I have a simple form. When the form's submit button is pressed, I want a JS confirm statement to capture if the user really wants to submit the form. The dialog comes up. confirm() does return false if Cancel is pressed in the confirm dialog, but the form is still submitted. The other buttons can submit the form. What am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<style>
.bg2 {background-color: #E1EBF2;}
html, body {
color: #536482;
background-color: #F5F7FA;
label: font-weight: 800;
}
</style>
<script>
function confirm_check() {
return confirm('Does this post conform to the board rules? If unfamiliar with the board rules, click Cancel then read the Board rules on the navigation bar. If it complies, submit the form again and select OK.')
}
</script>
</head>
<body>
<title>Posting form</title>
<h1>Posting form</h1>
<div class="bg2">
<form action="./thanks.html" method="get">
<div>
<dl>
<dt><label for="subject">Subject:</label></dt>
<dd><input type="text" name="subject" id="subject" size="45" maxlength="120" tabindex="2" value="" class="inputbox autowidth" /></dd>
</dl>
</div>
<div>
<textarea name="message" id="message" rows="15" cols="76" tabindex="4" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();" class="inputbox" style="position: relative;">
</textarea>
</div>
<input type="submit" accesskey="k" tabindex="7" name="save" value="Save draft" class="button2">
<input type="submit" tabindex="5" name="preview" value="Preview" class="button1">
<input type="submit" accesskey="s" tabindex="6" name="post" onclick="confirm_check();" value="Submit" class="button1 default-submit-action">
</form>
</body>
</html>