Prevent duplicate QSO form submissions
Prevent duplicate QSO form submissions - Add isSubmitting flag to track form submission state - Implement event listener on qso_input form to prevent multiple submissions - Block subsequent submit attempts while form is processing - Add comprehensive JSDoc documentation for the feature - Prevents duplicate QSO contacts from being created accidentally Fixes #3181
这个提交包含在:
父节点
34510470ce
当前提交
85ffd419ab
共有 1 个文件被更改,包括 23 次插入 和 2 次删除
|
|
@ -1338,7 +1338,6 @@ if ($this->session->userdata('user_id') != null) {
|
||||||
// Clear the input field
|
// Clear the input field
|
||||||
document.getElementById('sendText').value = '';
|
document.getElementById('sendText').value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($this->optionslib->get_option('dxcache_url') != '') { ?>
|
<?php if ($this->optionslib->get_option('dxcache_url') != '') { ?>
|
||||||
|
|
@ -1834,6 +1833,28 @@ if ($this->session->userdata('user_id') != null) {
|
||||||
|
|
||||||
// Event listeners
|
// Event listeners
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents multiple form submissions by tracking submission state
|
||||||
|
*
|
||||||
|
* This script prevents duplicate QSO (contact) submissions by:
|
||||||
|
* - Maintaining an isSubmitting flag to track form submission state
|
||||||
|
* - Adding an event listener to the 'qso_input' form
|
||||||
|
* - Preventing form submission if a submission is already in progress
|
||||||
|
* - Setting the flag to true when a valid submission begins
|
||||||
|
*
|
||||||
|
* @since Unknown
|
||||||
|
* @global boolean isSubmitting Flag to track if form is currently being submitted
|
||||||
|
*/
|
||||||
|
let isSubmitting = false;
|
||||||
|
document.getElementById('qso_input').addEventListener('submit', function(e) {
|
||||||
|
if (isSubmitting) {
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
isSubmitting = true;
|
||||||
|
});
|
||||||
|
|
||||||
// Update frequency every three seconds for the selected radio
|
// Update frequency every three seconds for the selected radio
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const selectedRadioID = $('select.radios option:selected').val();
|
const selectedRadioID = $('select.radios option:selected').val();
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用