7

Assume there is a Field aaaNumber__c on Account defined as Number(12,2)

Now I use it like this

<aura:component controller="elfL1" implements="forceCommunity:availableForAllPageTypes,force:appHostable">
    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <aura:attribute name="account"  type="Account" default="{ sobjectType: 'Account' }" />
    <h1>Test1</h1>
    <form>
        <force:inputField value="{!v.account.Name}" class="form-control uiInput--input input" />
        <force:inputField value="{!v.account.aaaNumber__c}"   />
        <br /><br /><br /><br /><br />
        <ui:button class="form-control" aura:id="button" label="Save" press="{!c.save}"/>
        <br />
    </form>
</aura:component>

My locale is set to "German (Germany,Euro)", this means the decimal separator is a comma , not the English dot . - this is very consistent along the aloha UI and Visualforce, too.

enter image description here

Now on the Lightning Component, when I enter a number I can write something like 20,3 and it will be saved correctly... BUT after reloading the page, it turns into 20.3 - with the dot.

How can we ensure that the locale is respected consistently in Lightning?

enter image description here

As you see, this runs in a Community created by Lightning Community Builder.

Client- and serverside controllers are like here - only querying aaaNumber__c additionally.

Alternatively I've tried to fall back to

 <ui:inputNumber class="form-control" value="{!v.account.aaaNumber__c}" />

instead of

<force:inputField value="{!v.account.aaaNumber__c}"   />

but the result is exactly the same.


UPDATE:

It's even worse. As described above if you save 21,3 it turns to 21.3 - now if you reload the page and get 21.3 and change this again to 21.33 and save again an reload, you get 2133 - without any decimal point at all.

Either I'm doing something wrong or this is a serious bug.

  • 1
    I can confirm this and its really BAD that there is no fix 3 years later. – Robert Sösemann Apr 10 '18 at 9:12
3

This is confirmed by Salesforce permier+ support as a bug. Fix has no ETA yet. As a consequence together with How to render the corresponding field-label automatically in Lightning? IMHO you can't use Lightning for complex I18n/L10n scenarios yet.

This has been recognized as a Bug at our end and currently an investigation has been raised to fix this.However we do not have ETA currently as when it is going to get fixed. I will go ahead and mark this case as Bug fix submitted. Please feel free to reach out to me at any time for your further concerns here.

  • 1
    Did you find any fix or workaround in the last 2 years? – Robert Sösemann Apr 13 '18 at 10:55
  • 1
    Hi Robert, usually we collect all the form data into a huge JSON and bind only that to one aura attribute. We do process the JSON in apex on our own including conversions. Not only mapping bugs but also performance lead us there. – Uwe Heim Apr 14 '18 at 8:45
  • Would you mind sharing a few details with code? See my recent open question on multicurreny and input fields in lightning. – Robert Sösemann Apr 14 '18 at 11:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.