Opened 15 years ago

Closed 14 years ago

#2864 closed enhancement (fixed)

number.js should allow the places constraint to be a range

Reported by: Douglas Hays Owned by: Adam Peller
Priority: high Milestone: 0.9
Component: General Version: 0.9
Keywords: Cc:
Blocked By: Blocking:


Currently number.js allows the places constraint to specify how many digits are allowed in the fractional part of a number. But often it needs to be in a range from 0-3 or something like that. The constraint needs a valid format for places to specify this like places=0,3 for a range or places=2 for an exact number.

Change History (8)

comment:1 Changed 15 years ago by Adam Peller

Milestone: 0.9M20.9beta
Priority: normallow

comment:2 Changed 15 years ago by liucougar

instead of places=0,3 , what about places=0-3 ?

comment:3 Changed 15 years ago by Adam Peller

Milestone: 0.9beta0.9

punting past beta, since nobody depends on this. the comma was chosen because it can be inserted directly into a regexp... not sure that's a good reason to do it that way, though. Any delimiter is going to be awkward.

comment:4 Changed 14 years ago by Adam Peller

Priority: lowhigh

fix this or at least update the docs, as the n,m thing doesn't work. see #3906

comment:5 Changed 14 years ago by guest

related...if i set places to null or undefined the default is 3. It is documented to be floating like 0-9999.

comment:6 Changed 14 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [10086]) Fix parse/regexp with places ranging from 0 to n: "0,n". Fixes #2864, Refs #3906

comment:7 Changed 14 years ago by John Locke

Resolution: fixed
Status: closedreopened

Regression: This appears to be broken in head, and 0.9. Setting places:'0,2' results in a NumberSpinner? that can spin down, but not up, and ignores the smallDelta parameter.

<input dojoType="dijit.form.NumberSpinner?" name="project_budget" id="proj_budget" value="0" size="4" smallDelta="0.25" largeDelta="4" constraints="{min:0.00, max:1000.00, places:'0,2'}"/>

comment:8 Changed 14 years ago by Adam Peller

Resolution: fixed
Status: reopenedclosed

Sounds like an issue with the widget rather than a regression in dojo.number. Creating #4477 to track the issue.

Note: See TracTickets for help on using tickets.