Hi,
In addition to what Stephen said, I just wanted to add that I find the behaviour you describe strange.
When a confirm box pops up, as you know, the user will have to click either "OK" or "Cancel" to proceed.
If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false.
In the context of processing a form, if handled correctly, a return value of false should return you to the form, whereas a return value of true should not interfere with the flow of execution.
Here's a very simple example to demonstrate what I mean:
HTML Code:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Confirm example</title>
</head>
<body>
<form id="myForm">
<input type="submit">
</form>
<script>
function logNumbersTo(num){
var conf=confirm("Are you sure about this?")
if (conf){
// Continue processing
for(var i=0; i<num; i++){
console.log(i);
}
}
}
f = document.getElementById("myForm");
f.onsubmit = function(){
logNumbersTo(10);
return false;
}
</script>
</body>
</html>
Perhaps I'm missing something.
Could you provide some code or a link to the page in question?
Bookmarks