Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12751 closed defect (invalid)

NumberSpinner and NumberTextBox no longer format values according to places constraint

Reported by: Cedric Hobbs Owned by: Douglas Hays
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

I encountered this regression in an application I'm working on, but in order to come up with a more wieldy test case, I started with a test page at I looked at the example under "The Basic Version", clicked the "Copy & Paste" tab, and copied the small bit of HTML. In my copy, I changed the "claro" theme to "tundra" for use across pre-1.5 versions and changed the 'places' attribute in the spinner to a non-zero value, 2. See attachment for my test version.

When I use version 1.4 in the <script> tag for dojo.js (and in the <link> tag for tundra.css), and open the page in a browser, I observe that if I enter a whole number like 1000 and blur out of the spinner, the value is formatted according the constraints so that it's display value is "1,000.00".

When I use versions 1.5 or 1.6, the number is not formatted upon blurring, and the text box is left in an invalid state.

If I use NumberTextBox instead of NumberSpinner, I get the same results.

Attachments (1)

NumberSpinner.html (821 bytes) - added by Cedric Hobbs 8 years ago.
Test case

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Cedric Hobbs

Attachment: NumberSpinner.html added

Test case

comment:1 Changed 8 years ago by bill

Component: GeneralDijit - Form
Description: modified (diff)
Owner: set to Douglas Hays

comment:2 Changed 8 years ago by Douglas Hays

Resolution: invalid
Status: newclosed

You have to specify fractional:[true,false] in the contraints if you want to be able to optionally specify decimal places. Prior to 1.5, the rules were a little loose.

comment:3 Changed 8 years ago by Cedric Hobbs

Thanks for the response, but setting 'fractional' in my test case doesn't seem to fix the observed regression. Moreover, what limited documentation I could find on constraints indicates that 'fractional' is for currency types.

I don't exactly want optional decimal places. I want the places value in my constraints to be treated as a formatter for when my input isn't focused, just like the comments in dijit.form.NumberTextBoxMixin? state.

It doesn't make sense that if places is 3, a value of 10.55 causes the input to be invalid. And if places is supposed to be used for formatting, I would expect a value of 10.55 to be formatted as 10.550, when the input loses focus.

What does seem to work so far is setting places to '0,N' rather than just N. I think this is just an accidental option, since the value of places is inserted in a set of brackets (for min, max counts) in a regex. But I wouldn't be surprised if this breaks other operations.

I still think this is a regression, but I'll leave this closed. If there are some undocumented options I can use in constraints to achieve the formatting that 'places' is expected to engender, then please provide additional information.


Note: See TracTickets for help on using tickets.