• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: better phone validation script

better phone validation script 14 years 4 months ago #9463

  • rayge
  • rayge's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
Here is a phone validation script that works best for me.
function phone($phone) {
	$phone_2 = preg_replace('/[^0-9]+/', '', $phone );
	if($phone_2=='') return true;
	$len = strlen($phone_2);
	if($len == 10 || $len == 11) {
		return true;
	} else {
		return false;
	}
}

It will allow the following methos of entering a phone number (and more)

123-456-7890
1-234-567-8901
1 (234) 567-8901
1.234.567.8901
1/234/567/8901
12345678901

It must be a 10 or 11 digit phone number.
If you want to allow an extension Id recommend adding a separate field for that using the numeric only validation.

Hope this helps people!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!