fix parent pages to adopt the school year logic
Tests / PHPUnit (push) Successful in 1m20s

This commit is contained in:
root
2026-07-17 00:02:53 -04:00
parent a5517b516a
commit 539d0eb220
12 changed files with 258 additions and 51 deletions
+12 -5
View File
@@ -37,11 +37,15 @@ export function validatePhoneLive(inputEl) {
// Prevent form submission if phone is invalid
function preventInvalidSubmission() {
const forms = document.querySelectorAll('form');
forms.forEach(form => {
const phoneInputs = document.querySelectorAll('#phoneInput');
phoneInputs.forEach(phoneInput => {
const form = phoneInput.closest('form');
if (!form) {
return;
}
form.addEventListener('submit', function (e) {
const phoneInput = document.getElementById('phoneInput');
if (phoneInput && !validatePhoneLive(phoneInput)) {
if (!validatePhoneLive(phoneInput)) {
e.preventDefault();
phoneInput.focus();
return false;
@@ -53,6 +57,9 @@ function preventInvalidSubmission() {
// Initialize the event listener when the page loads
document.addEventListener('DOMContentLoaded', function () {
const phoneInput = document.getElementById('phoneInput');
if (!phoneInput) {
return;
}
// Add input event listener for live validation and formatting
phoneInput.addEventListener('input', function () {
@@ -71,4 +78,4 @@ document.addEventListener('DOMContentLoaded', function () {
// Prevent form submission for invalid phone numbers
preventInvalidSubmission();
});
});