| 
Welcome, Guest
  • Page:
  • 1

TOPIC: phone number field

phone number field 1 year, 11 months ago #125932

  • Posts:
  • Karma:
Does anyone have a way to do a phone number field for CB such that when a user is creating an account and is asked to put in a phone number, that the field is formatted? Like so:

( ) -

so they just start typing numbers and they fit into that template in the field above?

Since there is an "email address" in the "Type" drop down, I was hoping there would be a type for phone number. No luck.

I was looking at doing a text field, then I used Expresso to come up with a Perl regex:

\((?<AreaCode>\d{3})\)\s*(?<Number>\d{3}(?\s*)\d{4})

But that's not quite what I wanted. Any ideas? Surely someone must already be doing this for a phone number field.

Thanks a bunch.
Joomla 1.5.7 Legacy mode
PHP 5.2.5
CB 1.2 Stable
The topic has been locked.

Re:phone number field 1 year, 11 months ago #126030

  • Posts:
  • Karma:
Ehem...just renewed my doc subscriber account. Didn't realize it had expired.

Any help?
Joomla 1.5.7 Legacy mode
PHP 5.2.5
CB 1.2 Stable
The topic has been locked.

Re:phone number field 1 year, 11 months ago #126582

  • Posts:
  • Karma:
Hi me, it's me again. Wow this effort really paid off.
Joomla 1.5.7 Legacy mode
PHP 5.2.5
CB 1.2 Stable
The topic has been locked.

Re:phone number field 1 year, 11 months ago #126617

  • Posts:
  • Karma:
Sorry for the delay, sometimes posts are missed among the many threads created daily. The only way to accomplish a phone number field is with a Text field and regex, which is what you've already done. The following regex should be sufficient for your needs.

 
\(?\b[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\b
 


The above expression will match 3334445555, 333.444.5555, 333-444-5555, 333 444 5555, (333) 444 5555 and any combination's of the previous.
Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Advanced, Professional, Developer, or CBSubs subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Advanced, Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My personal site(s)/link(s): AllMySocials - Tutorials
The topic has been locked.
  • Page:
  • 1
Time to create page: 0.75 seconds