function markComplete(formId) {
const checkbox = document.getElementById(formId);
const isChecked = checkbox.checked;
// AJAX request to save completion status
fetch('/updateFormStatus', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ formId, isChecked }),
})
.then(response => {
if (response.ok) {
alert(
Status updated for <span class="hljs-subst">${checkbox.nextElementSibling.innerText}</span>
);
}
})
.catch(error => console.error('Error:', error));
}