Opened 9 years ago
Closed 9 years ago
#17390 closed defect (fixed)
ValidationTextBox constructor sets constraints to {}
Reported by: | patrickzope | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | undecided | Milestone: | 1.10 |
Component: | Dijit - Form | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The ValidationTextBox?'s constructor sets the constraints attribute to {}, a value which is also defined as an attribute in the call to dojo/_base/declare.
This makes it impossible to declare subclasses of ValidationTextBox? that simply set the constraints and pattern attributes like so:
declare(ValidationTextBox, { constraints: {allowCruft: false}, pattern: dojox.validate.regexp.emailAddress });
Attachments (3)
Change History (10)
comment:1 Changed 9 years ago by
Component: | General → Dijit - Form |
---|---|
Milestone: | tbd → 1.9.2 |
Resolution: | → fixed |
Status: | new → closed |
comment:2 Changed 9 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
That's the workaround, although it would be better to be able to set constraints on the prototype.
That weird code is from 8c26273a5ed64033fddfdb1035bff435fe421bab and [7558] and [10412], as a workaround to the problem that dojo.regexp writes directly to the object passed in.
In any case it's not something that we fixed in 1.9.2, so we should either mark this as wontfix or actually fix it.
Changed 9 years ago by
comment:3 Changed 9 years ago by
I think there are two folds for this defect
- Constraints can be set on the prototype;
- Constraints can be modified in one instance independently from other instances.
Please see my fix in the attached patch.txt.
comment:4 Changed 9 years ago by
Milestone: | 1.9.2 → tbd |
---|---|
Owner: | set to Douglas Hays |
Status: | reopened → assigned |
Looks reasonable although we need an automated test case before checking it in.
Changed 9 years ago by
comment:5 Changed 9 years ago by
Basic.js is a test case for my patch. (I did want to modify its name to be testcase.js but I did not figure out how to do it. Sorry!)
Changed 9 years ago by
Attachment: | test_validation_constraints.html added |
---|
comment:6 Changed 9 years ago by
Milestone: | tbd → 1.10 |
---|
comment:7 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In order to preserve getters/setters, I think you really want something like this (you really don't want to set constraints on the prototype, you want to set them on the constructor)