From d665e1f03a4970c37083934ff29ddf87bb9636b0 Mon Sep 17 00:00:00 2001 From: dereklseitz Date: Sun, 17 Aug 2025 20:00:58 -0500 Subject: [PATCH] fix: Update phone input validation pattern --- src/scripts/contact-form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/contact-form.js b/src/scripts/contact-form.js index 8c53ba9..f7082af 100644 --- a/src/scripts/contact-form.js +++ b/src/scripts/contact-form.js @@ -88,9 +88,9 @@ form.addEventListener("submit", function(event) { } // Phone — match format: 123-456-7890 - const phonePattern = /^\d{3}-\d{3}-\d{4}$/; + const phonePattern = /^(\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4})$/; if (!phonePattern.test(phone)) { - showError("phone", "Phone number must be in the format 123-456-7890."); + showError("phone", "Phone number format is invalid."); hasErrors = true; }