ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Phone Number Validation

Munkey990 23 Apr, 2014
Trying to add a phone number field to a simple contact form. I have the box for required checked and the box for validate checked. If I leave the filed blank, it does validate that it is required. But the field does do any validation that it is 10 digits. I can enter a single digit and it does not stop it. I realize that the number itself cannot be validated but I assumed that it would be validated to be 10 digits. What do I have missing to do a valid that the phone number a user enters is a 10 digit phone number?
GreyHead 23 Apr, 2014
HI Munkey990,

Most telephone numbers around the world aren't 10 digits :-(

The FormCheck library that ChronoForms v4 uses has this regex for the phone ^\+{0,1}[0-9 \(\)\.\-]+$ This basically says that the result may start with a + or not and then uses only 0-9, space, () - and . in nay combination.

You can set up a custom validation to use a more specific test. Please see this FAQ

Bob
Munkey990 23 Apr, 2014
There are 2 check boxes for phone validation. 1 says "Phone" the other says "International Phone". Am I wrong to assume that "Phone" only checks for a 10 digit domestic phone number? Either way, I can input just the number 1 and it apparently passes validation and sends the form. It does not stop and I get an email with 1 for the phone number
Munkey990 23 Apr, 2014
So the phone validation is only validating the characters used, not validating that anything is in a correct phone number length/format?
GreyHead 24 Apr, 2014
Hui munkey,

You are indeed wrong to assume that there is any difference between the two phone validations. I have no idea why :-( You'd need to ask the FormCheck developers.

These validations work as I described, they are checking characters, not length (whatever the 'correct' length may be - in the UK it is mostly 11 digits).

Bob
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com