Categories > TinyButStrong general >

Format Phone Numbers

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: ryan
Date: 2007-02-26
Time: 16:55

Format Phone Numbers

I was curious if in future releases of TBS there could be a Phone Number format... usually when i put phone numbers in a database, i just put them in as numbers, w/o any formatting. It would be cool to do something like [var.phoneNumber; frm='(000) 000-0000'] or ...frm='000.000.0000' I looked at the class file to do a 'makeshift' version of this, but I am not the best PHP programmer out there...

Anyways, just a thought...
By: Bob
Date: 2007-02-27
Time: 18:03

Re: Format Phone Numbers

Hi,

Such a format is not planned for a next version of TBS.
But you can use parameter "onformat" with a custom function to cook your own phone format.
By: Pirjo Posio
Date: 2007-02-28
Time: 00:21

Re: Format Phone Numbers

I want to remind anybody who wants to store a telephone number, that often there are foreign customers, who have different telephone numbers than those used in your own country. I have often been frustrated by services, which won't allow me to give my correct telephone number, but still insist having one.

The correct telephone numbers in my country are like this:
+358 19 1234 5678 or  +358 400 1234 5678 or  +358 9 1234 5678
The last 8 numbers in these is the local phone number, which can be 4-8 numbers.
Without the country code these are normally written like this:
(019) 1234 5678  or   0400-1234 5678  or  (09) 1234 5678
Not a good idea to format it automatically, or to allow only numbers.