Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#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 10 years ago by bill

Milestone: 1.4.1tbd
Owner: set to Douglas Hays
Summary: dijit.form.FilteringSelect "required" attrbute does not workFilteringSelect: "required" attribute broken for blank <option>

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.

comment:2 Changed 10 years ago by Douglas Hays

Resolution: invalid
Status: newclosed

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 10 years ago by Douglas Hays

#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 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.