fix: Update phone input validation pattern
This commit is contained in:
parent
628df8cb2b
commit
d665e1f03a
|
@ -88,9 +88,9 @@ form.addEventListener("submit", function(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phone — match format: 123-456-7890
|
// 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)) {
|
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;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue