+ Start a Discussion
Ertyq MrskErtyq Mrsk 

Text Field Not Formatted in Currency When Selecting Currency Symbol from Dropdown List

I've been repeatedly modifying a Salesforce LWC page which aims to format a text field into a currency format (with corresponding currency symbols, commas, and decimals). Displayed currency symbol depends on the selected value from Currency__c field.

Since I wanted to format the inputted text value when user leaves that input field, I used javascript's onblur event.

But upon leaving the input field, a Lightning error occurs, like the following:

User-added imageAlso, I checked the browser's console log, and it displays the value inputted from the text field. I am not sure what is wrong with my page. I even checked some tutorials if I got the correct event, and looks like onblur fits my requirement.

Meanwhile, below are the latest codes:

//portion of js file

@wire(getPicklistValuesByRecordType, { objectApiName: CUSTOM_OBJECT, recordTypeId: '$objectInfo.data.defaultRecordTypeId'})
currencyPicklistValues({error, data}) {
    if(data) {
        this.error = null;
        let currencyOptions = [{label:'--None--', value:'--None--'}];
        data.picklistFieldValues.Currency__c.values.forEach(key => {
                label : key.label,
                value: key.value

        this.currencyValues = currencyOptions;


    else if(error) {
        this.error = JSON.stringify(error);

handleCurrencyDropDownChange(event) {

    this.custObj.Currency__c = event.target.value;
    this.selectedCurrency = this.custObj.Currency__c;


handleTextFieldChange(event) {

    this.custObj.Text_Field__c = event.target.value;
    const currencySelected = this.custObj.Currency__c; 
    console.log('Currency Selected' + currencySelected);

    if(currencySelected === '$') {

        var formattedString;

        console.log('Text Field' + this.custObj.Text_Field__c);

        formattedString = '$' + this.custObj.Text_Field__c.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, "$&,");
        console.log('Formatted Text Field' + formattedString);

    //same goes with other currency symbols....

<!--portion of html template-->

<lightning-combobox label="Currency" 

<lightning-input label="Text Field"

AbhishekAbhishek (Salesforce Developers) 

The code looks fine to me.

"-1934174971" With this Error ID raise a case with Salesforce support team so our team check-in our internal logs and get back to you.

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Ertyq MrskErtyq Mrsk
I just made this on my Developer org. Is it also eligible for Salesforce support?
AbhishekAbhishek (Salesforce Developers) 
You can raise a case with your production Org ID and mention the issue in Developer Org(Attach the org ID too).
Ertyq MrskErtyq Mrsk
I raised a case to customer support via my Salesforce Trailblazer community account.