phone number field

14 years 1 month ago #125932 by webpromulich
phone number field was created by webpromulich
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

Please Log in to join the conversation.

14 years 1 month ago #126030 by webpromulich
Replied by webpromulich on topic Re:phone number field
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

Please Log in to join the conversation.

14 years 1 month ago #126582 by webpromulich
Replied by webpromulich on topic Re:phone number field
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

Please Log in to join the conversation.

14 years 1 month ago #126617 by krileon
Replied by krileon on topic Re:phone number field
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.

[code:1]
\(?\b[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\b
[/code:1]

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 + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions 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 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 CST to 4:00 PM CST. 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 role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.215 seconds