#9671 closed defect (fixed)
dijit.NumberTextBox (and related) do use editOptions pattern with custom pattern in constraints
Reported by: | Phil DeJarnett | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Dijit - Form | Version: | 1.3.2 |
Keywords: | NumberTextBox CurrencyTextBox | Cc: | |
Blocked By: | Blocking: |
Description
Due to this line (line 93):
constraints = dojo.mixin(dojo.mixin({}, this.editOptions), constraints);
If a custom pattern is supplied (say, to allow -$1.00 or 00051 formatted values), the edit pattern never gets applied, and it becomes difficult to edit other formats.
I believe the line should be modified, to give editOptions preference over constraints (so a user can still override editOptions.pattern is necessary):
constraints = dojo.mixin({}, constraints, this.editOptions);
Also, as above, there is no reason to call mixin multiple times, as it handles multiple arguments.
Attachments (1)
Change History (12)
comment:1 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|---|
Owner: | set to Douglas Hays |
comment:2 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 11 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
[19941] breaks Spinner_mouse.html, specifically that typing "0.5" into the first spinner is no longer flagged as an error (it doesn't turn yellow).
The first spinner has constraints:
<input dojoType="dijit.form.NumberSpinner" ... constraints="{max:1550,places:0}"
comment:4 Changed 11 years ago by
Priority: | normal → high |
---|
comment:5 Changed 11 years ago by
Status: | reopened → new |
---|
comment:6 Changed 11 years ago by
Status: | new → assigned |
---|
comment:7 Changed 11 years ago by
Oops, in [20441] I just changed the Spinner_mouse.html test to type "0.a" rather than "0.5", thinking that the latter *wasn't* invalid. Please change it back after fixing this.
Changed 11 years ago by
Attachment: | 9671.patch added |
---|
Fixes #9671. isValid now checks with parse to determine whether the user's partial input is valid. _getValueAttr uses more strict detection of exponential values.
comment:9 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:10 Changed 11 years ago by
comment:11 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
(In [19941]) Fixes #9671, #9729. Changed constraints mixin to add editOptions last. Added test for editOptions to test_validate.html. Add specialized isValid to NumberTextBox? to return the correct isValid when editing and the displayed value has not yet been formatted. This happens when ENTER is pressed inside a Form widget. Fixed an automated test oops.