ng2-validation icon indicating copy to clipboard operation
ng2-validation copied to clipboard

Phone Validation Does Not Work

Open whoang11 opened this issue 8 years ago • 8 comments

The email validation works great on my screen. However, the phone validation always displays "error message" for these valid phone numbers: 1-555-111-3333, 555-111-3333, or 5551113333. Here is the code that I used:

phonevalidate

Thank you in advance for your support.

Wen Hoang

whoang11 avatar Jan 11 '17 21:01 whoang11

in the latest version, 555-111-3333 and 5551113333 are correct. But the 1-555-111-3333 is not. You can see the regexp

/^(\(?[0-9]{3}\)?)((\s|\-){1})?[0-9]{3}((\s|\-){1})?[0-9]{4}$/

yuyang041060120 avatar Feb 16 '17 02:02 yuyang041060120

Phone validation is not working for me. If i use phone="US" on the input element, then validation will work only for numbers like 5551113333 but not 555-111-3333 or (555) 111-3333. Using phone="en-US" or [phone]="'en-US'" throws an error message saying "Unable to get property '9' of undefined or null reference" in the get_types function. I think that's within the LibPhoneNumber library. Just wondering if anyone else was seeing this.

mikelt21 avatar Apr 27 '17 16:04 mikelt21

@mikelt21 same for me: TypeError: Cannot read property '9' of undefined.

Aleolly avatar May 10 '17 22:05 Aleolly

same for me: TypeError: Cannot read property '9' of undefined.

wqdjl avatar Jul 10 '17 09:07 wqdjl

@mikelt21 you have a solution?

wqdjl avatar Jul 10 '17 09:07 wqdjl

Having the same issue as @mikelt21

sdornan avatar Aug 29 '17 20:08 sdornan

Getting this error after i upgraded to Angular 5 during phone validation.

ERROR TypeError: Cannot read property '9' of undefined at get_types (metadata.js:105) at Object.is_valid (validate.js:34) at Object.isValidNumber (index.es6.js:42)

Tried phone="US" but it doesn't work and breaks down. Unable to complete the forms with phone #.

Please Can anyone help?

moghuln avatar Apr 17 '18 13:04 moghuln

Having the same issue with "zh-CN", and "'en-US" throws an error message saying "Unable to get property '9' of undefined or null reference"

when i use "US" the validation always fails with values like "1-555-111-3333", "555-111-3333", "5551113333" but when i use "IR" validation always succeeds no matter what is the input angular version : 7.2.0 ng2-validation: 4.2.0

HadiGolkarian avatar Jan 15 '19 06:01 HadiGolkarian