#10725 closed defect (wontfix)
Calling validate() on an empty but required ValidationTextBox does not trigger the correct decoration
Reported by: | mvaerle | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit - Form | Version: | 1.4.0 |
Keywords: | Cc: | Douglas Hays | |
Blocked By: | Blocking: |
Description (last modified by )
When leaving a required ValidationTextBox empty calling validate() on it does return false but does not make it yellow with an icon indicating the field does not validate.
When clicking in and out of the field the decoration does appear.
When calling validate() on the form that contains the ValidationTextBox the decoration also appears.
This can be tested with: http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/test_validationState.html
1) Do not touch the field after the page has loaded
2) call: dijit.byId("name").validate()
3) Returns false but field doesn't change
4) call: dijit.byId("form1").validate()
5) The field gets focus, this is by design I think because the form has only one field that doesn't validate, when I have a form with multiple fields that don't validate they do turn yellow.
Another consideration might be triggering this on calling isValid() on the form, that is what tripped me up the first time, replacing isValid() from the examples in the dijit tests with validate() would be more intuitive perhaps.
Thanks!
Change History (3)
comment:1 Changed 12 years ago by
Cc: | Douglas Hays added |
---|---|
Description: | modified (diff) |
Resolution: | → wontfix |
Status: | new → closed |
comment:2 Changed 12 years ago by
Since you want to change the behavior of the ValidationTextBox? subclasses, I would add the following and then not call validate yourself. It'll just happen automagically.
dojo.extend(dijit.form.ValidationTextBox, { _hasBeenBlurred: true });
comment:3 Changed 11 years ago by
Component: | Dijit → Dijit - Form |
---|
I can see why you expect the field to turn yellow after calling validate().
However, by design, we don't mark a field as yellow (even if it is invalid) until the user has touched it. I.e. tabbed into/out of the field, or clicked it and then clicked somewhere else.
Note that validate() is actually called on every ValidationTextBox on page load.
So I don't think we want to change the current behavior, although you can easily get the effect you want by doing:
(same as Form does).
Doug, anything to add?