Formbuilder Phone Number (US) Validation Error

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
SINphul
Forum Members
Forum Members
Posts: 23
Joined: Wed Jan 07, 2009 3:24 am

Formbuilder Phone Number (US) Validation Error

Post by SINphul »

Hello everyone.  Formbuilder is giving me a bit of validation trouble right out of the gate, and I was wondering if anyone could assist me in pinpointing the cause.  Whenever I place a text field with validation for "Phone Number (US)," it doesn't seem to take any kind of number (valid or otherwise), and continually gives me this error:

Code: Select all

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /home/content/h/b/c/hbcpk/html/modules/FormBuilder/classes/TextField.class.php on line 119

* Please enter a valid phone number for "Phone"
I've already tried every known way to type a phone number for the US, but to no avail.  Anyone have any potential fixes or a similar situation?  Thanks in advance for any incite.
styson

Re: Formbuilder Phone Number (US) Validation Error

Post by styson »

I'm having the same problem.  (###) ###-#### should be the proper format but it doesn't work.  Any fix or known format that works? 
Last edited by styson on Fri Mar 13, 2009 5:05 pm, edited 1 time in total.
janb

Re: Formbuilder Phone Number (US) Validation Error

Post by janb »

Hi

I had the same problem with date validation and made my own string for that.
I'm not 100% sure but i think the code in modules/FormBulider/classes/TextField.class.php is wrong.

In line 119 (FormBulider 0.5.5) the original code is

Code: Select all


! preg_match('^([0-9][\s\.-]?)?(\(?[0-9]{3}\)?|[0-9]{3})[\s\.-]?([0-9]{3}[\s\.-]?[0-9]{4}|[a-zA-Z0-9]{7})(\s?(x|ext|ext.)\s?[a-zA-Z0-9]+)?$',

I think the correct preg_match format should start with '/ and ends with /' like this

Code: Select all


! preg_match('/^([0-9][\s\.-]?)?(\(?[0-9]{3}\)?|[0-9]{3})[\s\.-]?([0-9]{3}[\s\.-]?[0-9]{4}|[a-zA-Z0-9]{7})(\s?(x|ext|ext.)\s?[a-zA-Z0-9]+)?$/',

NB not tested with Phone Number (US)

JanB
Last edited by janb on Fri Mar 13, 2009 6:06 pm, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”