#10361 closed defect (duplicate)
dijit.form.NumberTextBox - commas not working in non-english locales
Reported by: | Al Briggs | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Dijit - Form | Version: | 1.3.2 |
Keywords: | Cc: | Adam Peller | |
Blocked By: | Blocking: |
Description
Using the NumberTextBox? and the formattting works great with European formatting for numbers - swapping commas for fullstops (periods) and the other way around.
However input is not so good if I input 1.000 - this is correctly interpreted as 1000 but 1,2 is not interpreted as 1.2. Instead when 1,2 is entered the validation box goes yellow and the invalid icon is displayed.
Specifically I am working in the German locale (de).
Attachments (1)
Change History (10)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
comment:3 Changed 11 years ago by
This worked for me:
<input dojoType="dijit.form.NumberTextBox" value="1.2" lang="de-de" constraints="{pattern:'#.############',fractional:[true,false]}">
comment:4 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Please reopen if you have a failing test case.
comment:5 Changed 11 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
I didn't explain the problem well enough - so please find an attached example html page.
The problem comes when you have a formatted number for example if I want a number formatted with 6 decimal places.
In the attached html you will see the value is initialized with 1.2 and formatted for display as 1,200000 - but if you input 1,2 then the box shows the input is invalid. If you enter 1.2 into the box acts normally. This means that the box works differently depending on whether you are using decimal or comma. In the case when input is in 'de-de' it should really complain when the user input 1.2 as this is not valid and 1.200 would be a valid input.
comment:6 Changed 11 years ago by
Cc: | Adam Peller added |
---|---|
Owner: | set to Douglas Hays |
Status: | reopened → new |
Assigning to Doug although this may be a problem with the the dojo.number code, in which case it should go to Adam... (or maybe it's a user error but the test case seems OK to me).
Note that the error is still hapenning in 1.4 trunk.
comment:7 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
2 issues that the user is complaining about: 1) 1.2 and 1,2 are acting differently in v1.3, and 2) 1,2 should be valid.
The first problem is already fixed in v1.4. The second problem is a user-error.
The testcase specifies places:6 but then 1,2 is invalid since you only specified 1 decimal place. In v1.3, an input of 1.2 bypassed this check and was reformatted but should have also been invalid for the same reason. Since you want to specify a variable number of places, use places:'0,6' instead. This allows you to specify between 0 and 6 decimal places, but the number will be formatted to 6 places.
comment:8 Changed 11 years ago by
marvellous thanks for you help! All problems gone with correct format - even in 1.3.2
comment:9 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
I'm looking at http://download.dojotoolkit.org/release-1.4.0b2/dojo-release-1.4.0b2/dijit/tests/form/test_validate.html in the second euro example, which is hardcoded to de locale. "1,2" doesn't work because you need two digits after the comma, but "1,20" is working fine.
Is that page working for you? Can you attach a test file where it's failing?