You need to sign in to do that
Don't have an account?
How to remove comma from <lightning-input-field > in lwc
Hello Everyone,
I need to remove comma from <lightning-input-field > in lwc. So what is happening is there is one number data type field that I am using in my record edit form but if i enter a number Salesforce automatically adds comma. So is there any way to remove that. I found one article for <lightning-input> where we can use any reg ex (pattern="^(0|[1-9][0-9]*)$" )pattern to remove commat but <lightning-input-field > does not support this reg ex pattern. How can i do the same thing with <lightning-input-field > . Anyone has idea on the same, please suggest any way. Thanks in advance.
Do you mean to remove commas while user is inputting right? Or do you mean to show to user in UI on view ?
Thanks,
This issue is happening for both lightning input field as well as lightning output field.So basically I need a workaround to remove comma from both the places .
If that is lightning-input you can use onchange event and remove the commas in js file as below.
If this solution helps, Please mark it as best answer.
Thanks,
I already tried this approach but it was not working .
Do you mean it is not working in input. When user gives value it is appending with comma before saving?
Thanks,