I live in sweden and my phone/app uses Swedish locale (Sv_SE).
What I want is an Entry field for decimal values.
I create an Entry field and set the Keybord to "Numeric". ( <Entry Keyboard="Numeric"/> )
This gives me a numeric keypad with BOTH "," and "." visible. However, pressing "," has no effect. Only the "." is accepted.
I also tried creating a custom renderer, like suggested here:
to set InputType = InputTypes.ClassNumber | InputTypes.NumberFlagSigned | InputTypes.NumberFlagDecimal
However, still only "." was accepted.
The device is a Google/LG Nexus 5 (phone) using Google Keyboard as it's keyboard.
Since my users here in sweden are used to write one and a half like "1,5" they will end up Writing "15" since the "," is ignored. This is NOT OK!
Please don't suggest to use
KeyListener = DigitsKeyListener.GetInstance("-0123456789,")
since this will force _me_ to check for valid decimal values (the user might otherwice write things like "3,5,4,3,,,9")
Created attachment 16444 [details]
I think the issue is more general: the ‘,’ and ‘-‘ characters on the numeric keyboard are not inputted regardless of the system language. I’ve attached a repro project that demonstrates this.
### Steps to Reproduce
1. Run the Android project
2. Attempt to enter a comma in the Entry
A workaround is to use a custom Entry renderer and use:
> KeyListener = DigitsKeyListener.GetInstance("-0123456789,")
If the Entry is bound to a double, the value entered should be parsed automatically to prevent multiple ‘,’ characters. However there is another bug affecting this (bug#42084). But there is a workaround for that issue as well provided in the report.
Andreas, I talked about the way to validate the text. I don't believe the keyboard should be responsible for data validation. To you, 3,5,4,3,,,9 might be incorrect behavior, but there are many ways to represent numbers internationally and custom logic can be required to generate custom patterns.
Should be fixed in 2.3.5-pre1
Tested in 22.214.171.124-pre3 and it does work. However, the solution provided is not very user friendly. The button that previously showed a period "." now displays ".-,+" instead. Users will then have to triple click that button every time they want to write a comma.
This might be ok, if you only have to use it once in a while, but when regularly having to input multiple numbers this quickly becomes cumbersome.
In my opinion, there should be a separate column for these symbols on the numeric keyboard, or at least the comma should be placed first on locales that use comma as decimal separator, so the user only have to press the button once.
(In reply to Lars from comment #4)
> Tested in 126.96.36.199-pre3 and it does work. However, the solution provided is
> not very user friendly. The button that previously showed a period "." now
> displays ".-,+" instead. Users will then have to triple click that button
> every time they want to write a comma.
> This might be ok, if you only have to use it once in a while, but when
> regularly having to input multiple numbers this quickly becomes cumbersome.
> In my opinion, there should be a separate column for these symbols on the
> numeric keyboard, or at least the comma should be placed first on locales
> that use comma as decimal separator, so the user only have to press the
> button once.
I just fired up my emulator and I don't see a button with ".-,+"; I see a "," button and a separate button for ".". So this might be an issue for specific devices or API levels that we overlooked. What device and version of Android are you seeing this behavior on?
The app we are making is primarily for use on tabs, but I have also tested it on my phone. I get the same issue on both devices.
Tab: Samsung Galaxy Tab Active 8.0" 16GB (OS: Android 5.1.1)
Phone: Samsung Galaxy S6 (OS: Android 7.0)
I have now tested on an emulator as well and I can see that you are right. There is a separate comma button there. So it could be that this is a problem that only affects Samsung devices.