EHDEM commited on
Commit
947f916
·
verified ·
1 Parent(s): 1901b6f

make attendance form A's student name dropdown list like attendance form B's student name dropdown list is which it only appears in the form when i have entered or chosen the form and class

Browse files
Files changed (1) hide show
  1. attendance.html +12 -13
attendance.html CHANGED
@@ -665,19 +665,18 @@ function updateDateTime() {
665
  studentSelect.disabled = true;
666
  }
667
  }
668
-
669
- // Show/hide student dropdown based on attendance selection
670
- document.querySelectorAll('input[name="attendance"]').forEach(radio => {
671
- radio.addEventListener('change', function() {
672
- if (this.value === 'yes') {
673
- document.getElementById('student-container').classList.remove('hidden');
674
- } else {
675
- document.getElementById('student-container').classList.add('hidden');
676
- document.getElementById('student').value = '';
677
- }
678
  });
679
- });
680
- // Function to reset the form
681
  function resetForm() {
682
  // Clear form fields
683
  document.getElementById('class').value = '';
@@ -711,7 +710,7 @@ document.getElementById('student-container').classList.add('hidden');
711
  // Initialize student dropdown based on initial selection
712
  if (document.querySelector('input[name="attendance"]:checked').value === 'yes') {
713
  document.getElementById('student-container').classList.remove('hidden');
714
- }
715
  </script>
716
  </body>
717
  </html>
 
665
  studentSelect.disabled = true;
666
  }
667
  }
668
+ // Show student dropdown only when attendance is "yes"
669
+ document.querySelectorAll('input[name="attendance"]').forEach(radio => {
670
+ radio.addEventListener('change', function() {
671
+ if (this.value === 'yes') {
672
+ loadStudents(); // Reload students in case class/form changed
673
+ } else {
674
+ document.getElementById('student-container').classList.add('hidden');
675
+ document.getElementById('student').value = '';
676
+ }
677
+ });
678
  });
679
+ // Function to reset the form
 
680
  function resetForm() {
681
  // Clear form fields
682
  document.getElementById('class').value = '';
 
710
  // Initialize student dropdown based on initial selection
711
  if (document.querySelector('input[name="attendance"]:checked').value === 'yes') {
712
  document.getElementById('student-container').classList.remove('hidden');
713
+ }
714
  </script>
715
  </body>
716
  </html>