CSR-1479 fix regex that prevents using number "1" as the...

first number in telephone number.
This commit is contained in:
Bryan Mauger 2023-06-27 13:55:42 -04:00
parent 6e4dc25c9b
commit 72a38c012a

View file

@ -75,8 +75,13 @@ export default {
// Update the phone number with the formatted version // Update the phone number with the formatted version
return formattedNumber; return formattedNumber;
}, },
filterNumber() { filterNumber(event) {
this.selectedValue = this.selectedValue.replace(/1/g, ""); const regex = /^(?!1)\d+/;
const inputValue = event.target.value;
if (!regex.test(inputValue)) {
// If the input violates the regex pattern, remove the leading 1
event.target.value = inputValue.replace(/^1/, "");
}
}, },
}, },
watch: { watch: {