ScoDoc/app/templates/scodoc/forms/evaluation_edit.j2

22 lines
885 B
Plaintext
Raw Normal View History

{# Interdit de définir des évaluations non normales "immédiates" #}
<script>
document.addEventListener('DOMContentLoaded', function() {
var evaluationTypeSelect = document.getElementById('tf_evaluation_type');
var publishIncompleteCheckbox = document.querySelector('input[type="checkbox"][name="publish_incomplete:list"]');
function updateCheckboxState() {
if (evaluationTypeSelect.value !== '0') {
publishIncompleteCheckbox.disabled = true;
publishIncompleteCheckbox.checked = false; // Ensure the checkbox is not checked
} else {
publishIncompleteCheckbox.disabled = false;
}
}
// Add event listener to select element
evaluationTypeSelect.addEventListener('change', updateCheckboxState);
// Initial call to set the correct state when the page loads
updateCheckboxState();
});
</script>