Opened 5 years ago

Closed 5 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 5 years ago by cjolif

Owner: set to Clement Mathieu
Priority: undecidedlow
Status: newassigned

comment:2 Changed 5 years ago by cjolif

Priority: lowhigh

comment:3 Changed 5 years ago by Clement Mathieu

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

Last edited 5 years ago by Clement Mathieu (previous) (diff)

comment:4 Changed 5 years ago by cjolif

Milestone: tbd1.9.8
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.