Opened 14 years ago
Closed 14 years ago
#1504 closed defect (fixed)
ComboBox/Select - manually setting values not working with forceValidOption set
Reported by: | Owned by: | Douglas Hays | |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | Widgets | Version: | 0.3 |
Keywords: | ComboBox, Select | Cc: | |
Blocked By: | Blocking: |
Description
Manually setting selected value is not working when forceValidOption is set. This is default behavior for the Select widget. Problem is in _isValidOption method. Value should be checked against the data array and not the list node items. Btw, first two rows of the method are repeated (typo).
Change History (7)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Something like this:
_isValidOption: function(){
var isValidOption = false; for(var i = 0; i < this.dataProvider.data.length; i++)
if(this._isInputEqualToResult(this.dataProvider.data[i][0])){
isValidOption = true; break;
};
return isValidOption;
}
comment:3 Changed 14 years ago by
Milestone: | 0.4 → 0.4.1 |
---|
comment:4 Changed 14 years ago by
Milestone: | 0.4.1 → 0.5 |
---|
Unfortunately this is going to require a protocol change. We've talked about this in other bug reports. Basically the sensible API is something like (for example):
mySelectWidget.setValue("CA");
which will set the (hidden) value to "CA" and the (displayed) label to "California". But that requires an API to the dataprovider to map from value to label. And in the case of incrementalDataProvider, that in turn requires a protocol from the client to the server.
Bumping to 0.5 for now.
comment:5 Changed 14 years ago by
Owner: | changed from bill to Douglas Hays |
---|
comment:6 Changed 14 years ago by
I fixed it on my version, will commit once dojo.data is sorted out.
When you type in California into any of the Select widgets in the test and press Enter or blur focus, the text remains and the value changes to CA.
Works only when the list is generated from an existing options list of the select form element. List node is not populated when using remote data provider.