3

I am using a lightning component to display a phone number.

I am currently in France and i want all the phone numbers to follow local formatting, which is not the case when i use the lightning component (Phone numbers are properly displayed in salesforce user interface).

So instead of displaying : 0474391085

i am getting : (047) 439-1085

He is the code i am using to display the phone number along with a bunch of other fields :

 some code here for aura iteration
<lightning:outputField fieldName="{!eachItem}" class="slds-hyphenate" />
 some code here

I think that the lightning:outputField automatically recognizes the field as a phone and applies the standard US format.

Do you have an idea how to preserve the origin format ?

  • Did yoi try to use <ui:outputText ? – m Peixoto Nov 23 '18 at 16:25
  • No, i t does not work, because in my code, "eachItem" contains the actual fields (fieldName__c) and the lightning:outputField uses this to fetch the data. when i use <ui:outputText> it actually prints out the field names – Merabti Ibrahim Nov 23 '18 at 16:33
  • the notation is different -> {!v.myText} developer.salesforce.com/docs/component-library/bundle/… – m Peixoto Nov 23 '18 at 16:37
  • @m Peixoto: I am using the variable in the context of an aura iteration so , i must use {!eachItem} instead of {!v.eachItem} – Merabti Ibrahim Nov 23 '18 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.