   return;
        }

        if (!phonePattern.test(phone)) {
            alert('Please enter a valid phone number (10 digits).');
            return;
        }

        // If validation passes, you can submit the form or perform another action
        alert('Form submitted successfully!');
        // Here you could submit the form via AJAX or similar
    }

    function restrictInputToNumbers(event) {
        const key = event.key;
        if (!/^\d$/.test(key) && key !== "Backspace" && key