[英]Stop form from submitted twice on multi-step form - JS
I am trying to stop the form from submitting multiple times so it does not charge their card multiple times, I have tried using the methods of a non-multi-step form but they do not produce the same outcome.我试图阻止表单多次提交,因此它不会多次向他们的卡收费,我尝试使用非多步骤表单的方法,但它们不会产生相同的结果。
CODE:代码:
I have tried using this but it also disables the next and previous buttons.我尝试过使用它,但它也会禁用下一个和上一个按钮。
$('#submit-form').click(function() {
if(this.form.checkValidity()) {
this.form.submit();
$('#msform').attr("action" , "javascript:void%200");
}
});
HERE IS THE FULL CODE:这是完整的代码:
https://jsfiddle.net/aL9uymcd/1/ https://jsfiddle.net/aL9uymcd/1/
let isSending = false
$('#submit-form').click(function() {
if (!isSending) {
isSending = true
// do your submit stuff here
}
})
You can wrap a logic check to prevent it submitting twice, then re-enable after您可以包装一个逻辑检查以防止它提交两次,然后重新启用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.