|
@using Syncfusion.Blazor.Inputs
<SfNumericTextBox TValue="int?" Value=1032323 Locale="fr"></SfNumericTextBox>
|
Hi,
I bring up the subject.
In France, when we use a keyboard with a numeric keypad, a dot is returned when we press the button provided for this purpose. However, software converts the dot to comma in numeric fields (notably Excel), because it's easier to enter numbers with the numeric keypad dot key. Limiting use to the comma key is a real handicap for a French user.
Do you have any solution ?
Regards,
Fred
Hi Frederic,
As per our previous update, we have supported the comma key when rendering the component by French culture loading. So, we suggest you render the component with French culture to achieve your requirement. Because by default our component supports the “en-US” format.
Regards,
Sureshkumar P
I think there is a misunderstanding on the subject. In France we must be able to press the "." key to get a comma in a numeric control. The decimal separator is the comma, indeed. But we are used to entering our numerical value with the "." key of the numeric keypad wich is automatically replaced by a comma in MS Excel for example.
Your SfNumericTextBox does not allow this. We are obliged to enter the comma on the keyboard. Which is not convenient for fluent numeric input.
Above you can see an AZERY keyboard (french format). As you can see, the numeric keypad has a "." (dot) key, not a "," (comma) key. It's therefore absolutely necessary to transform the "." to "," during a numeric entry. All software do this. From Windows calculator to MS Excel and accouting software. Otherwise imagine an accountant being forced to go get the comma key each time he enters a number with decimals. That would be insane !
We have validated
the numerictextbox component. the component works as expected. We suspect that
you have rendered our numerictextbox as locales with ',' as decimal separator but
not changed the system settings as supported to locales with ',' as decimal
separator. We suggest you change the same locale (system setting) with your
local system to achieve your requirement.
Please find the system settings.
Language settings: (Deutsch as default language)
|
|
System region setting:
|
|
Then render the numeric textbox with the same Deutsch culture:
|
|
The problem is not with the locales. Our decimal separator is indeed the comma and your control does display the comma correctly. The problem is that the numeric keypad does not return a comma but a dot. It's therefore not possible to use your control with a numeric keypad to enter decimal numbers.
With your numeric control, when we press the dot key on the numeric keypad, nothing appens with french locales. Your control expects a comma. But we don't have a comma on the numeric keypad, just a dot.
So MS Excel, Calculators, and other softwares transform the dot in comma when we use it.
But your controls expects yet a comma.
So we need the dot on the numeric keypad to become a comme in your numeric control.
If you want to reproduce the problem, switch your system in French with French locales and try entering a decimal value only with the numeric keypad.
Here is another video. In this one I use your control versus MS Excel. You will see that with your control a numeric entry using the [.] key on numpad gives nothing (no decimals), while the same entry in MS Excel will return a decimal value with comma as decimal separator. This is the behavior we expect.
Hi Frederic,
We have customized the sample based on your requirement when pressing the (.) in the numeric pad as convert to (,). Please find the sample below. We would like to let you that in the provided sample, we have invoked the javascript file with decimal separator obtained in the server end with the help of CultureInfo. Therefore, on the client end, we can get the separator value based on the culture info obtained from the server end.
Find the code example here:
|
[index.razor] <SfNumericTextBox ID="numeric" TValue="double?" Value=10> <NumericTextBoxEvents TValue="double?" Created="onCreate"></NumericTextBoxEvents> </SfNumericTextBox>
@code { [Inject] protected IJSRuntime JsRuntime { get; set; } public String Decimal{ get; set; }
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); } }
[uploader.js] window.create = (id, decimal) => { window.decimalValue = decimal; document.getElementById(id).addEventListener("keypress", valueChange); } function valueChange(args) { if (args.code === "NumpadDecimal") { if (!this.value.includes(window.decimalValue) && window.decimalValue !== ".") { this.value = this.value.slice(0, this.selectionStart) + window.decimalValue + this.value.slice(this.selectionStart); } } } [_Host.cshtml] <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/bootstrap5.css" rel="stylesheet"> <script src="https://cdn.syncfusion.com/blazor/20.1.47/syncfusion-blazor.min.js"></script> <script src="~/Uploader.js"></script> |
Find the sample in the attachment:
Regards,
Sureshkumar P
Perfect
Many thanks
Best regards
Frederic,
Thanks for your update.
Regards,
Sureshkumar P