#13797 closed defect (fixed)
dijit.form.Select with required=true not revalidating when changed
Reported by: | mmccreary | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Dijit - Form | Version: | 1.6.1 |
Keywords: | select required validate | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
If a dijit.form.Select’s required param is set to true, the select box validates correctly when dijit.form.Select.validate() is called explicitly. However, if a select box’s state is “error” after validate() is called, it remains in “error” even when a valid option is selected.
I have extended the dijit.form.Select’s validate() function and confirmed that it is not being called when onChange is fired. That was the behavior in 1.5.1 and in 1.6.1 other widgets seem to re-validate onChange.
Attachments (1)
Change History (9)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Component: | General → Dijit - Form |
---|---|
Owner: | set to Douglas Hays |
comment:3 Changed 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I need to understand how to recreate this problem before any code is changed. I tried to run validate() from a button onclick handler but everything seems to be working properly. Please attach a small HTML file showing the problem.
comment:4 Changed 11 years ago by
Maybe I didn’t explain the problem very well. The issue is not running validate() on the button’s onClick, or the form’s onSubmit. The issue is that the dijit.form.Select is not re-validating onChange.
I’ve attached a small HTML file. I’ve added a small line of CSS to allow the Selects to display as yellow when in error to be consistent with other Widgets. Also, I’m using Firefox 3.6.21.
To recreate the issue:
- First load the HTML.
- Without selecting any values click the submit button. (Note that both Selects and the FilteringSelect? are in a state of error)
- Then select a valid option on the Selects and FilteringSelect? (Note that the Selects remain in a state of error until validate() is explicitly called, while the FilteringSelect? is now in a valid state)
comment:5 Changed 11 years ago by
Also, as a comparison, change the dojo version to 1.5.1 on the HTML that I submitted and run through the same steps. Then note the behavior of the Selects
comment:6 Changed 11 years ago by
Milestone: | tbd → 1.7 |
---|---|
Resolution: | worksforme → fixed |
Thanks for the testcase. When I run the testcase using Dojo 1.7 (trunk), then it behaves much better. Can you verify this is fixed using trunk?
comment:7 Changed 11 years ago by
This does appear to be working much better using Dojo 1.7 (trunk).
comment:8 Changed 11 years ago by
Summary: | dijit.form.Select not validating onChange when required=true → dijit.form.Select with required=true not revalidating when changed |
---|
Just trying to make summary more understandable.
As a work around I have added the following javascript