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: Need an input mask for phone number. Help?

Re:Need an input mask for phone number. Help? 14 years 10 months ago #7760

  • bogdanc
  • bogdanc's Avatar
  • OFFLINE
  • Moderator
  • Posts: 669
  • Thank you received: 11
Hello,

Try this code for a custom phone number validation:
function phone($phone)
{
list($number1,$number2,$number3)=split("-",$phone,3);
if($phone=='' || strlen($phone)!=10 || !(is_numeric($number1)) || !(is_numeric($number2)) || !(is_numeric($number3)) || strlen($number3)!=2) return false;
if(ereg('^([0-9]{4})-([0-9]{4})-([0-9]{3})$', $phone))
return false;
else
return true;
}

Note that you will have customize it to validate what phone numbers formats you want. It currently validates numbers like: 123-456-78

Regards!
The administrator has disabled public write access.

Re:Need an input mask for phone number. Help? 12 years 7 months ago #14869

  • capfranco
  • capfranco's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 1
Hi. I need help to customize this validation. I would like to have the format: 55-5555-5555 (suitable for Brazil). I tried some stuff myself, no sucess tho. :(

Thanks in advance.
Last Edit: 12 years 7 months ago by capfranco. Reason: spelling
The administrator has disabled public write access.

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!