Opened 12 years ago
Closed 7 years ago
#10582 closed defect (patchwelcome)
dijit.form.NumberTextBox incorrectly handle percentages
Reported by: | Jean-Rubin Leonard | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.13 |
Component: | Dijit - Form | Version: | 1.4.0 |
Keywords: | NumberTextBox percent percentage | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
dijit.form.NumberTextBox is unable to handle percentages as they are used in real life. In the attached text file there are three examples.
In the first example I create a ntb with constraints="{type: 'percent'}". If you enter ‘10%’. Its all good. If you leave the ntb and come back to it, it’s edited and shows 0.1. This immediately triggers the invalidMessage which it should not. If we enter 10.34% it doesn’t work and specifying constraints="{type: 'percent',places:2}" doesn’t change that either. This is not a localization issue as 10,34% doesn’t work either. Allowing the use of decimal in the ntb and allowing users to enter 0.1234 or 12.34% would go a long way into making it usable in real life application. The current features aren’t adequate.
We face the same kind of problem when using constraints="{pattern: '##0.####%'}". This also have the further disadvantage of not being globalized as the pattern is hard coded and will not be changed according to the users’ locale.
Attachments (2)
Change History (12)
Changed 12 years ago by
Attachment: | numberTextBoxes.html added |
---|
comment:1 Changed 12 years ago by
Description: | modified (diff) |
---|---|
Owner: | set to Douglas Hays |
comment:2 Changed 12 years ago by
Milestone: | tbd → future |
---|
comment:3 Changed 12 years ago by
Changed 12 years ago by
Attachment: | textboxesUpdated.html added |
---|
comment:4 Changed 12 years ago by
There are three issues with the current state of the numberTextBox: 1) It seems that if we specify constraints, we must specify places for the textbox to be instantiated correctly. If we don't the parser stops with the error "parts[1] is undefined". 2) If we create the textbox with places:0 and enter 80%, get back of the numberTextbox and back into it to edit it, the number that shows is 1 instead of the expected 0.8. If we enter 20%, the number that appears is 0 instead of the expected 0.2 3) If we create the textbox with places:1 and enter 80.1%, get back of the numberTextbox and back into it to edit it, the number that shows is 0.8 instead of the expected 0.81. If we enter 20.1, it edits as 0.2 instead of the expected 0.2
comment:5 Changed 12 years ago by
comment:6 Changed 12 years ago by
comment:7 Changed 11 years ago by
Component: | Dijit → Dijit - Form |
---|
comment:8 Changed 8 years ago by
Owner: | Douglas Hays deleted |
---|---|
Status: | new → assigned |
comment:9 Changed 8 years ago by
Status: | assigned → open |
---|
comment:10 Changed 7 years ago by
Milestone: | future → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | open → closed |
Given that no one has shown interest in creating a patch in the past 5+ years, I'm closing this as patchwelcome.
Prereq on #10701