Tribune

Home » Liferay Portal » English » 2. Using Liferay » General

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Andrej Litowka
How to format phone number?
31 gennaio 2011 4.14
Risposta

Andrej Litowka

Punteggio: Junior Member

Messaggi: 68

Data di Iscrizione: 30 giugno 2010

Messaggi recenti

Hello all,

I'm using liferay 6.0.2 and adding phone numbers in a portlet with PhoneServiceUtil.updatePhone or PhoneServiceUtil.addPhone. Even if I enter the phone number as e.g. +49 (0) 111 222 333 it will be saved in the table Phone as 49111222333 and also shown on the page like this. I would save the phone number in the same format as I entered it in the form. The field Phone.number_ is a VARCHAR, so it should be possible. Is there any liferay build-in functionality to save the numbers in my own format? How I can configure this? If not, is the only possibility to format phone numbers to implement own PhoneNumberFormat? Currently only USAPhoneNumberFormat is available. There is no formater for Europe.

Thanks and regards,
Andrej
Jeremy A. Morgenröter
RE: How to format phone number?
11 maggio 2011 5.23
Risposta

Jeremy A. Morgenröter

Punteggio: New Member

Messaggi: 10

Data di Iscrizione: 3 febbraio 2010

Messaggi recenti

Hello Andrej,

just set
##
## Format
##

#
# Set the location of the class that implements
# com.liferay.format.PhoneNumberFormat. This class will format phone
# numbers.
#
#com.liferay.util.format.PhoneNumberFormat=com.liferay.util.format.USAPhoneNumberFormat
com.liferay.util.format.PhoneNumberFormat=com.liferay.util.format.IdenticalPhoneNumberFormat


in your system-ext.properties and restart Liferay. Works fine using LP6 GA4.

Best Regards.
Jack Bakker
RE: How to format phone number?
22 settembre 2012 7.09
Risposta

Jack Bakker

Punteggio: Liferay Master

Messaggi: 598

Data di Iscrizione: 3 gennaio 2010

Messaggi recenti

com.liferay.util.format options are not comprehensive, of course neither are my phoneformat utils that I've been putting in a seperate *clientname*-utils that I export as jar to global classpath

there is a google libphonenumber (http://code.google.com/p/libphonenumber/) I am currently reviewing

are u experienced ? if so pls share... thx
Hitoshi Ozawa
RE: How to format phone number?
22 settembre 2012 19.50
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 7990

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

The major problem with the current com.liferay.util.format is that I'm not able to specify different format for different locale. That is, if I have it in US format, I can't have Japanese format as well.
Jack Bakker
RE: How to format phone number?
30 settembre 2012 14.10
Risposta

Jack Bakker

Punteggio: Liferay Master

Messaggi: 598

Data di Iscrizione: 3 gennaio 2010

Messaggi recenti

yes Hitoshi, u have restated my wondering need

the chosen Borg takes time to assimilate
Hitoshi Ozawa
RE: How to format phone number?
30 settembre 2012 16.33
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 7990

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

I've been adding country/lang attributes to jsp selections but I don't think I can do the same with phone number because a Japanese user may want to enter US phone number. I think I'll add a countryId parameter to a method to verify phone number. I'll put this in my backlog because I don't need it in a hurry.

Fall is the event time in Japan to get users to budget for next financial year. Kind of busy on this front lately.
Xav NYC
RE: How to format phone number?
25 febbraio 2013 21.55
Risposta

Xav NYC

Punteggio: New Member

Messaggi: 22

Data di Iscrizione: 27 settembre 2012

Messaggi recenti

Hi the google phone number library does just that. https://code.google.com/p/libphonenumber/
It's a matter of integrating it to Liferay.
Hitoshi Ozawa
RE: How to format phone number?
26 febbraio 2013 4.52
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 7990

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

Thanks for the information. I think I'll be able to use that in my Japanese edition of liferay.