fix the exam draft
This commit is contained in:
@@ -306,6 +306,14 @@
|
||||
const forms = document.querySelectorAll('.needs-validation');
|
||||
Array.from(forms).forEach(form => {
|
||||
form.addEventListener('submit', event => {
|
||||
const islamicUnits = form.querySelectorAll('input[name="unit_islamic[]"]');
|
||||
const hasIslamicUnit = Array.from(islamicUnits).some(input => input.value.trim() !== '');
|
||||
if (!hasIslamicUnit) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
alert('Please select at least one Islamic Studies unit.');
|
||||
return;
|
||||
}
|
||||
if (!form.checkValidity()) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -461,6 +469,10 @@
|
||||
confirmButton.addEventListener('click', () => {
|
||||
confirmInput.value = '1';
|
||||
const form = confirmButton.closest('form') || document.querySelector('form.needs-validation');
|
||||
if (form && typeof form.requestSubmit === 'function') {
|
||||
form.requestSubmit();
|
||||
return;
|
||||
}
|
||||
if (form) {
|
||||
form.submit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user