How to replace '.' by ','

Hello,
I'm using a sfNumericTextBox in a locale with ',' as decimal separator.
I want to make every time user inputs a '.'  in the sfNumericTextBox,  convert it to a ','


Current behavior: User inputs 12.34   =  sfNumericTextBox has a value of 1234
Desired behavior :  User inputs 12.34   =  sfNumericTextBox has a value of 12,34

Is this possible?

Thanks

16 Replies

SP Sureshkumar P Syncfusion Team October 7, 2020 12:27 PM UTC

Hi Alex,  
 
 
Thanks for the patience.  
 
 
We resolved the reported issue in the latest version V18.3.38.  Kindly upgrade the application to the latest version to get rid of the reported issue.  
 
 
 
  
 
 
Regards,  
Sureshkumar P 



AL Alex October 8, 2020 10:11 AM UTC

This does not resolves my problem.
Problem is, in locales with ',' as decimal separator we need to use numeric pad '.'  as a ',' for quick input decimals using keyboard numeric pad.
Excel, Windows calculator and all apps convert keyboard numeric pad '.' to ','
I want to do the same with syncfusion numeric text box.

Current behavior: User inputs 12.34   =  sfNumericTextBox has a value of 1234
Desired behavior :  User inputs 12.34   =  sfNumericTextBox has a value of 12,34



SP Sureshkumar P Syncfusion Team October 9, 2020 11:27 AM UTC

Hi Alex,  
  
Thanks for your update.  
  
Based on your shared details, we have validated the numerictextbox component. the component works as expected. We suspect that you have changed the system settings as supported to locales with ',' as decimal separator but not render our numerictextbox with same locale. We suggest you render the numerictextbox with same locale (system setting) to achieve your requirement.  
 
Please find the system settings. 
1.     Language settings: (Deutsch as default language) 
 
 
2.     System region setting: 
 
 
3.     Then render the numerictextbox with same Deutsch culture: 
 
 
We have prepared the sample with Deutsch culture. Please run the sample with above mentioned system settings.  
 
 
Regards,  
Sureshkumar P 



RA Rafael February 5, 2021 09:15 AM UTC

Hi,

As Alex said, when pressing NumPadDot key the sfNumericTextBox doesn't put the decimal separator when culture use the comma decimal separator.
If i press the comma symbol it works.

Regards


AL Alex February 5, 2021 11:33 AM UTC

I know this problem is hard to understand for people not using localizations with ',' as a decimal separator.
So far none of the "solutions" address the problem.

Please Syncfusion developers, set up your machine in a locale that uses ',' (comma) as a decimal separator.
Now try to type a decimal number WITH THE NUMERIC KEYPAD in the numeric textbox.
You can't.
This is a common need, especially for number crunching applications.
As I said, Excel, the windows calculator and most apps that need numeric input, address this problem by changing the numeric keypad dot '.'  by a comma ','

This needs to be handled in Javascript, I did it in my web apps(not using syncfusion). Listen for keyboard input and when numpaddot is received replace it with a comma, move caret, etc.
Maybe you just could add a property 'UseNumericDotAsComma', just an idea, so the programmer could toggle this behavior.

Again:
Current behavior: User inputs in the keyboard numeric pad '12.34'   =  sfNumericTextBox has a value of  '1234'
Desired behavior :  User inputs in the keyboard numeric pad  '12.34'   =  sfNumericTextBox has a value of  '12,34'


SP Sureshkumar P Syncfusion Team February 8, 2021 09:53 AM UTC

Hi Alex, 
 
Thanks for your update. 
 
As per our previous October 9th,2020 update. We have suggested you maintain the same culture in the system and rendered numerictextbox component. we have taken the video demonstration for your reference the same issue is not replicated from our end.  
 
Please find the video demonstration when type the number key pad dot the component enters comma key. 
 
 
Regards, 
Sureshkumar P 



DA Daniel February 16, 2021 04:34 PM UTC

I have the same problem of Alex and Rafael. When I press NumPad Dot the sfNumericTextBox doesn't put the decimal separator. If I press the comma symbol it works. I'm using Spanish or British culture. It's an important bug.


AL Alex February 16, 2021 04:40 PM UTC

Yes what's shown in the video is the desired behavior. However I'm not experiencing the same, in my case it doesn't work.
Also I can't make the user fiddle in some browser configuration, It should work out of the box, as any other application.


VS Vignesh Srinivasan Syncfusion Team February 22, 2021 06:52 PM UTC

Hi Alex, 
 
As mentioned before we could not replicate the issue from our end. We have customized the sample based on your requirement when press the (.) in numeric pad as convert to (,). Please find the sample below. 
 
 
Kindly check with the above sample and reply us if the provided solution works for you. 
 
Regards, 
 
Vignesh Srinivasan. 
 



DA Daniel February 23, 2021 08:08 AM UTC

Hi Vignesh, not the best solution, but it works. I think, if you try to test your sfnumerictextbox on a Spanish system you will replicate this issue,

Regards

Daniel


JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team March 2, 2021 12:14 PM UTC

Hello Daniel,

Good day to you.

We received your request and we are validating the same. We will check and update the further details on or before 17th March 2021.

We appreciate your patience until then.

Thanks, 
Jeyanth. 



DA Daniel March 2, 2021 12:25 PM UTC

Thank you


AL Alex March 2, 2021 12:30 PM UTC

Tried your sample.
Does not work on a Spanish machine


JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team March 3, 2021 04:46 PM UTC

Hello Alex,

Good day to you.

We validated the reported issue in the Spanish machine. With the provided solution, we could not replicate the issue. Can you please provide below information to investigate this issue?

1. Video demonstration for the reported issue.
2. We have provided solution using JS interop. Can you please ensure whether the respective method in javascript file is invoked or not in your sample?

Thanks, 
Jeyanth. 



AL Alex replied to Jeyanth Muthu Pratheeban Sankara Subramanian March 3, 2021 05:54 PM UTC

Hello Alex,

Good day to you.

We validated the reported issue in the Spanish machine. With the provided solution, we could not replicate the issue. Can you please provide below information to investigate this issue?

1. Video demonstration for the reported issue.
2. We have provided solution using JS interop. Can you please ensure whether the respective method in javascript file is invoked or not in your sample?

Thanks, 
Jeyanth. 


First video, sample running demonstrating issue:

Second video, I added some log lines to the javascript code


Code inside this 'if'  never gets called:

if (!this.value.includes(window.decimalValue) && window.decimalValue !== ".") {
            console.log("dot found");
            this.value =
                this.value.slice(0, this.selectionStart) +
            window.decimalValue +
                this.value.slice(this.selectionStart);
        }


JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team March 4, 2021 02:37 PM UTC

Hi Alex,

Thanks for sharing the video demonstration. 

We validated the reported issue based on the provided video demonstration. We would like to know you that we have invoked the javascript file with decimal separator obtained in the server end with the help of CultureInfo.


 
public async Task onCreate() 
    { 
        var currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name; 
        var ci = new CultureInfo(currentCulture); 
        Decimal = ci.NumberFormat.NumberDecimalSeparator; 
        await JsRuntime.InvokeVoidAsync("create""numeric",Decimal); 
    } 


Therefore, in the client end, we can get the separator value based on the culture info obtained from the server end. If you specifically want to override the ”.” separator with “,”, we suggest you to send the separator value “,” in the server end without obtaining from the culture info.

Please let us know if you need any further assistance on this.

Regards, 
Jeyanth. 


Loader.
Up arrow icon