Opened 13 years ago

Closed 13 years ago

#1504 closed defect (fixed)

ComboBox/Select - manually setting values not working with forceValidOption set

Reported by: acirov@… 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 13 years ago by acirov@…

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.

comment:2 Changed 13 years ago by acirov@…

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 13 years ago by dylan

Milestone: 0.40.4.1

comment:4 Changed 13 years ago by bill

Milestone: 0.4.10.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 13 years ago by Douglas Hays

Owner: changed from bill to Douglas Hays

comment:6 Changed 13 years ago by haysmark@…

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.

comment:7 Changed 13 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [8352]) Port of ComboBox?(=AutoCompleter?) and Select widgets to 0.9 dojo by haysmark@…. Fixes #2189, #1504, #1451, #2244, #2384, #2070, #899, #912, #1267, #1339, #1456, #1484, #1485, #2558, #1186

Note: See TracTickets for help on using tickets.