• 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: Two new validation scripts

Two new validation scripts 15 years 2 months ago #6798

US Social Security Number:
function SSN($ssn)
{
if ($ssn == '') return true;
if (eregi('^[0-9]{3}[- ][0-9]{2}[- ][0-9]{4}|[0-9]{9}$',$ssn))
return true;
else
return false;
}

US 10-digit phone:
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;
 
}

Enjoy, and MANY thanks to Alexandru!
The administrator has disabled public write access.

Re:Two new validation scripts 14 years 8 months ago #8409

I was having problems with the regular expressions in this script. I looked around and found this one that seemed better for my purposes. It accepts standard U.S. phone numbers as well as '1-800' numbers.

Just replace this piece of code
'^((?[2-9]{1}[0-9]{2})?|[0-9]{3,3}[-. ]?)[ ]?[0-9]{3,3}[-. ]?[0-9]{4,4}$'

With this other one
'^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$'

Your validation will now accept numbers in these formats:

XXX-XXX-XXXX
and
X-XXX-XXX-XXXX
The administrator has disabled public write access.

Re:Two new validation scripts 14 years 3 months ago #9674

  • komita
  • komita's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 40
  • Thank you received: 1
i'm new so sorry if this is obvious.

where exactly am i putting this phone script?

thanks, Lauri
The administrator has disabled public write access.

Re:Two new validation scripts 14 years 3 months ago #9680

  • andreic
  • andreic's Avatar
  • NOW ONLINE
  • RSJoomla! Official Staff
  • Posts: 733
  • Thank you received: 60
Hello,

komita please refer to the following article regarding custom validation with RSForm!Pro:

www.rsjoomla.com/customer-support/docume...alidation-rules.html
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
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!