#10648 closed defect (invalid)
FilteringSelect: "required" attribute broken for blank <option>
Reported by: | Daniel Stefaniuk | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit - Form | Version: | 1.4.0 |
Keywords: | FilteringSelect required | Cc: | |
Blocked By: | Blocking: |
Description
At the moment required attribute does not work with blank option. It is due to the isValid function not being coded properly.
The code is as follow:
isValid: function(){ return this._isvalid || (!this.required && this.attr('displayedValue') == ""); },
however it should be:
isValid: function(){ return this._isvalid && (!this.required || this.attr('displayedValue') != ""); },
Change History (4)
comment:1 Changed 11 years ago by
Milestone: | 1.4.1 → tbd |
---|---|
Owner: | set to Douglas Hays |
Summary: | dijit.form.FilteringSelect "required" attrbute does not work → FilteringSelect: "required" attribute broken for blank <option> |
comment:2 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
If user input matches a datastore record, then it's valid by design. In the case of a blank record, then a valid item object is assigned and onChange is called with that value. The correct behavior is to specify value= on instantiation and not have a blank record in the datastore. Note that this scenario is currently not working but will be fixed in #10431.
comment:3 Changed 11 years ago by
#10431 has been fixed in trunk. value="" and required=true will cause the textbox to be blank and will create an error condition as long as there's no blank option in the datastore.
comment:4 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
Is this a regression? Hopefully not. required is working in general but I guess you are speaking specifically about having a blank entry in the drop down.