This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 42000 - Unable to use comma (",") as decimal point
Summary: Unable to use comma (",") as decimal point
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.3.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-20 15:24 UTC by Andreas
Modified: 2017-02-17 11:18 UTC (History)
6 users (show)

See Also:
Tags: Android ac
Is this bug a regression?: ---
Last known good build:


Attachments
repro solution (268.92 KB, application/zip)
2016-06-22 18:27 UTC, Jimmy Garrido
Details

Description Andreas 2016-06-20 15:24:44 UTC
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:
https://bugzilla.xamarin.com/show_bug.cgi?id=25373
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")
Comment 1 Jimmy Garrido 2016-06-22 18:27:10 UTC
Created attachment 16444 [details]
repro solution

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 


### Workaround
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.
Comment 2 adrianknight89 2016-09-30 02:42:11 UTC
See https://github.com/xamarin/Xamarin.Forms/pull/396

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.
Comment 3 Rui Marinho 2017-02-17 11:18:23 UTC
Should be fixed in 2.3.5-pre1

Note You need to log in before you can comment on or make changes to this bug.