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

Need an input mask for phone number. Help? 9 years 5 months ago #6470

Hi everyone,

Has anyone had any success using an input mask so that the user can only enter phone numbers in a certain format?

Can someone help me with this?

Thanks,
Adam
The administrator has disabled public write access.

Re:Need an input mask for phone number. Help? 9 years 1 month ago #7450

  • tallship
  • tallship's Avatar
  • OFFLINE
  • Fresh Boarder
  • So foul a sky clears not without a storm
  • Posts: 8
What I've done is to just have them put in numeric characters only, and then pull them from the database ww/a Perl script when I need to generate my reports. In Perl it's easy to format everything, but I haven't found a way to do this in RSFormsPro yet, so I'm just taking the numeric value and then formatting it later when I pull it from the database via Perl.

But then again, the reports that are generated are emailed off and I'm not staying internal to Joomla.
Bradley D. Thornton
Manager Network Services
NOMAD Internetwork
NorthTech Computer
http://NorthTech.US

The administrator has disabled public write access.

Re:Need an input mask for phone number. Help? 9 years 1 month ago #7488

  • bogdan
  • bogdan's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 122
  • Thank you received: 4
Hello ,

You can try using this telephone validation:
function phone($phone)
{
if( $phone=='' ) return true;
if(eregi('^(\(?[2-9]{1}[0-9]{2}\)?|[0-9]{3,3}[-. ]?)[ ]?[0-9]{3,3}[-. ]?[0-9]{4,4}$', $phone ))
return true;
else
return false;
}
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here

RSJoomla! Development Team
Last Edit: 9 years 1 month ago by bogdan.
The administrator has disabled public write access.

Re:Need an input mask for phone number. Help? 9 years 1 month ago #7489

where would I put that code if I wanted to use it?
The administrator has disabled public write access.

Re:Need an input mask for phone number. Help? 9 years 1 month ago #7490

  • bogdan
  • bogdan's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 122
  • Thank you received: 4
Hello ,

put the code in the /components/com_rsform/controller/validation.php

Regards!
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here

RSJoomla! Development Team
Last Edit: 9 years 1 month ago by bogdan.
The administrator has disabled public write access.

Re:Need an input mask for phone number. Help? 9 years 3 weeks ago #7735

I added the phone validation as outlined and now I get this message whenever I try to use the phone validation:

Warning: eregi() [function.eregi]: REG_BADRPT in /home/surreyau/public_html/components/com_rsform/controller/validation.php on line 74


Any ideas? I copied the validation script right from the forum...
The administrator has disabled public write access.

Re:Need an input mask for phone number. Help? 9 years 3 weeks ago #7760

  • bogdanc
  • bogdanc's Avatar
  • OFFLINE
  • Moderator
  • Posts: 669
  • Thank you received: 10
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? 6 years 9 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: 6 years 9 months ago by capfranco. Reason: spelling
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!