function validateForm() { const phoneInput = document.getElementById('phone'); const contactError = document.getElementById('contact-error'); let isValid = true; // Clear any previous error messages contactError.textContent = ""; // Validate Phone Number const phoneCriteria = /^\d{10}$/; // Ensure exactly 10 digits if (!phoneCriteria.test(phoneInput.value)) { contactError.textContent = "Phone number must be exactly 10 digits."; phoneInput.classList.add("border-red-500"); // Add red border if invalid isValid = false; } else { phoneInput.classList.remove("border-red-500"); // Remove red border if valid } return isValid; // Return false to prevent submission if validation fails }