Security

Reply
Occasional Contributor II

SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

Ello Ello,

 

Having some trouble with validating the mobile number on my self-registration page.  I have the felid set to validate using NwaSmsIsValidPhoneNumber, however this doesn't seem to be working.  I 'm able to successfully register with numerical entries as short as 5 digits.  This is not good enough, as even benign typos will eventually start filling up my database.  

 

Surely there's a way to get proper SMS validation working? Or is this by design...

 

Thank you

Aruba

Re: SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

How many digits do you think the phone number should have?

 

If you want to enforce a particular phone number format then you can use a different validator, e.g. a regular expression validator could be used to match a 10 digit phone number.

Occasional Contributor II

Re: SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

Yes Id like to enforce at least to 10 digits.  Where can I add a custom validator for a regular expression?

Occasional Contributor II

Re: SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

Got it!

For anyone else who's interested, IsRegExMatch is the validator and this long expression below seems to do the trick.

^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$

 

 Edit: this one works as well and is more simple.

^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$

 

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: