Answer the question
In order to leave comments, you need to log in
How to make phone validation on form input?
How to make validation on the form when entering or when inserting a record of this type into the form +7 (999) 999-99-99 ?
at the output I want the form to display this type +79999999999 I
wrote such a validation.
validatePhone(event) {
const { target } = event;
const validatePhone = target.value.replace(/\D/g, '').match(/(\d{0,1})(\d{0,10})/);
target.value = '+7'+validatePhone[2];
this.formPhone.Phone = target.value = '+7'+validatePhone[2];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question