所以我有一個看起來像這樣的形式:形式被提交即使的onsubmit函數返回false
<form class="form-horizontal" method="POST" onSubmit="submitFormButton()">
和我submitformbutton功能:
function submitFormButton(){
document.getElementById('vacationApplicationForm').action = '';
document.getElementById('vacationApplicationForm').method = 'POST';
if (showWarning == true){
var agree = confirm("wtf?");
if (agree){
document.getElementById('vacationApplicationForm').submit();
} else {
return false;
}
} else {
document.getElementById('vacationApplicationForm').submit();
}
}
當我點擊確認對話框取消該表格仍在提交中。我在這裏做錯了什麼?
如果你把'返回false會發生什麼;'在函數的結束? – Dumisani