Regular Expression for Phone US problem

User 65981 Photo


Registered User
18 posts

Had to laugh. Finally got the new computer up and running, and installed Web Form Builder. Opened a sample fb (Retreat Registration) and "previewed" it. All seems well ... until one enters a phone number. LOL The example, "890-123-4567" fails the test. Huh?! Hmmm ... let's see.

8901234567 works.
(890) 123-4567 works.
8901234567 works.
890 123 4567 works.
890 1234567 works.

But, not the OEM example (with TWO dashes)!

For the record,

890-123-4567 does not work.
890 123-4567 does not work.
890.123.4567 does not work.
890 123.4567 does not work.
(890) 123.4567 does not work.
(890) 1234567 does not work.

Sure some are unlikely but the first and last are quite possible ... just sayin ...

United States
/(([01][\.\- +]\(\d{3}\)[\.\- +]?)|([01][\.\- +]\d{3}[\.\- +])|(\(\d{3}\) ?)|(\d{3}[- \.]))?\d{3}[- \.]\d{4}/
Allows just about any type of US phone number formatting, including area codes in parentheses, leading 1s, and spaces as separators.
( http://www.coffeecup.com/help/articles/ … honenumber ).

Presumably this is "built into" the program, any ideas on how to fix this or when an update will be out? Hopefully soon as I've been tasked with publishing a Little League Registration Form (with PayPal) by the end of the year. Thanks.

User 2088758 Photo


Senior Advisor
3,121 posts

I would just put a format reminder either in the field itself or underneath. Usually I do both put it right in the field with a note under to remind them to use desire formatting.
Taking over the world one website at a time!

Steve Kolish
www.misterwebguy.com

YouTube Channel:
https://www.youtube.com/channel/UCL8qVv … ttneYaMSJA
User 2484360 Photo


Registered User
3,293 posts

Presumably this is "built into" the program, any ideas on how to fix this or when an update will be out? Hopefully soon as I've been tasked with publishing a Little League Registration Form (with PayPal) by the end of the year. Thanks.


The dash (-) character had to be removed from the Phone Field Element in Web Form Builder because on a mobile phone, there is no dash on the number pad. If this character was required, any user on a mobile phone would not be able to submit the form they are filling out.

There however is a work around for this. Instead of a Phone Field Element, you can use a Regular Expression or Text Field Element. Both of these would allow you to use the dash (-) character. This would also allow users on mobile phones to still submit the form.
User 508072 Photo


Registered User
4 posts

Hello,

I don't see why you have to omit the "-" dash altogether?? If the cell phone user can still submit the phone number and just enter digits, why not allow it?

Terri
User 38401 Photo


Senior Advisor
10,951 posts

Ok I'll bite at the obvious question here. What does the number pad on a phone have to do with filling out a form? I have a dash on my phone's keyboard that will fill in a form just fine which I'm sure most people have on their phones as well. How does the dash have anything to do with the number pad and the form? I see no correlation here at all. You don't fill out a form with your number pad of your form you fill it out using symbols like you do for parenthesis and most every other symbol.
User 103173 Photo


VP of Software Development
0 posts

Jo Ann wrote:
Ok I'll bite at the obvious question here. What does the number pad on a phone have to do with filling out a form? I have a dash on my phone's keyboard that will fill in a form just fine which I'm sure most people have on their phones as well. How does the dash have anything to do with the number pad and the form? I see no correlation here at all. You don't fill out a form with your number pad of your form you fill it out using symbols like you do for parenthesis and most every other symbol.

For the HTML5 specs, the Phone Number Element can only use numbers. If you want to use dashes, underscores or any other character, just use the Input Text Element instead. It is that easy. ;)

The correlation between the two is when you attempt to fill out a form that uses a Phone Number Element, the dial pad automatically appears because the browser knows it is a Phone Number. When you use a Texts Element, the virtual keyboard will appear instead.

The reason why (other then following the HTML5 specs) is the dial pad of any phone does not have a dash character. It only has 0-9 numbers. Don't shoot the messenger. That is how it is. ;)
Learn the essentials with these quick tips for Responsive Site Designer, Responsive Email Designer, Foundation Framer, and the new Bootstrap Builder. You'll be making awesome, code-free responsive websites and newsletters like a boss.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.