Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigDecimalField does not accept decimal separator characters in non-English locales #2904

Closed
tmusin opened this issue Feb 17, 2024 · 1 comment
Labels
state: won't fix This will not be worked on type: bug Something isn't working

Comments

@tmusin
Copy link

tmusin commented Feb 17, 2024

Environment

Jmix version: 2.1.3

Bug Description

The decimal separator for bigDecimalField cannot be anything other than a comma character, even if it is configured in the locale format properties or in the NumberFormat field annotation.

Steps To Reproduce

  1. Create a project with English and non-English locales (for example, Vietnamese or Russian).
  2. Leave the default number separator formats:
numberDecimalSeparator=.
numberGroupingSeparator=,
  1. Create an entity with an attribute of type BigDeciamal:
@NumberFormat(pattern = "#,##0.########", decimalSeparator = ".", groupingSeparator = ",")
@Column(name = "AMOUNT", precision = 20, scale = 8)
private BigDecimal amount;
  1. Create lists and detail views, use the bigDecimal field for the amount attribute:
<bigDecimalField id="amountField" property="amount">
    <validators>
        <digits integer="20"
                     fraction="8"
                     message="Wrong format"/>
    </validators>
</bigDecimalField>
  1. Run the project in a non-English locale, open the detail view, try entering 1,234.56789 in the amount field.

Current Behavior

Can't enter a dot. But if you type 1234.56789, it will be saved and displayed in the list view as 1,234.56789.
If you enter 1,234,56789, it will be stored as a empty value.

Expected Behavior

You can enter the entire number with group and decimal separators.

Note:

If you are logging in with an English locale, you can enter a dot in the field, but not a comma.

Sample Project

BigDecimalLocale.zip

@tmusin tmusin added type: bug Something isn't working triage Issue is waiting for triage labels Feb 17, 2024
@gorbunkov gorbunkov removed the triage Issue is waiting for triage label Mar 1, 2024
@glebfox
Copy link
Contributor

glebfox commented Mar 1, 2024

Vaadin's BigDecimalField, IntegerField and other number fields have no format attribute. For example BigDecimalField is <input type="text" inputmode="decimal"> and works according to inputmode attribute.

Use <textField> that support datatype instead.

@glebfox glebfox closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2024
@glebfox glebfox added the state: won't fix This will not be worked on label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: won't fix This will not be worked on type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants