Opened 6 years ago
Closed 6 years ago
#18466 closed defect (fixed)
CurrencyTextBox does not warn on leading spaces when entering a number (French local)
Reported by: | Clement Mathieu | Owned by: | Clement Mathieu |
---|---|---|---|
Priority: | high | Milestone: | 1.9.8 |
Component: | Dijit - Form | Version: | 1.9.7 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
In English local you can't start a number in CurrencyTextBox? with a space.
In French local you can. However there is no reason for that. Leading spaces are not correct in French.
Here is a sample to reproduce the issue:
<html> <head> <style type="text/css"> @import "themes/claro/claro.css"; </style> <script type="text/javascript" data-dojo-config="isDebug: false, async: true, parseOnLoad: true, locale:'fr-fr'" src="../dojo/dojo.js"></script> <script> require(["dojo/parser", "dijit/form/CurrencyTextBox"], function(parser, CurrencyTextBox) { parser.parse(); }); </script> </head> <body> <input type="text" data-dojo-type="dijit/form/CurrencyTextBox" data-dojo-props=""> </body> </html>
Change History (4)
comment:1 Changed 6 years ago by
Owner: | set to Clement Mathieu |
---|---|
Priority: | undecided → low |
Status: | new → assigned |
comment:2 Changed 6 years ago by
Priority: | low → high |
---|
comment:4 Changed 6 years ago by
Milestone: | tbd → 1.9.8 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
fixed in https://github.com/dojo/dojo/commit/f0d04b79749cd292fc30fcd11e4fd1ed51f6633e and backported down to 1.9 branch.
Note: See
TracTickets for help on using
tickets.
After investigating this, I think the problem lies into the regexp generation function in
dojo/number.js
.Especially, https://github.com/dojo/dojo/blob/master/number.js#L348 is problematic. If the currency pattern from cldr contains a space before or after the currency symbol, those spaces will be matched by the regexp even if the symbol is undefined (like when there is no currency constraint on the
CurrencyTextBox
).This behavior looks like a bug to me as those spaces are here only because of the currency symbol and don't have a meaning without it (which is different of white spaces used as group delimiter).
A potential fix can be found in https://github.com/dojo/dojo/pull/139