Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#2558 closed defect (fixed)

ComboBox: default selection of 'Iowa' becomes 'Iowaka'

Reported by: djboulia@… Owned by: Douglas Hays
Priority: high Milestone: 0.9
Component: Widgets Version: 0.4.1
Keywords: Cc: djboulia@…
Blocked By: Blocking:

Description

If you load this page and simply hit the drop down in Combo Box #1, 
you'll notice that the default selection of 'Iowa' becomes 'Iowaka'.  
This is due the following code within _openResultList in ComboBox.js 
(lines 704-707 in dojo 0.41 build on the community source site):

			if(	(this.autoComplete)&&
				(results.length)&&
				(!this._prev_key_backspace)&&
				(this.textInputNode.value.length > 0)){
				var cpos = this._getCaretPos(this.textInputNode);
				// only try to extend if we added the last character at the end of the input
				if((cpos+1) > this.textInputNode.value.length
(code needed here to check that input matches our first result??)
                                 ){
					// only add to input node as we would overwrite Capitalisation of chars
					this.textInputNode.value += results[0][0].substr(cpos);
					// build a new range that has the distance from the earlier
					// caret position to the end of the first string selected
					this._setSelectedRange(this.textInputNode, cpos, this.textInputNode.value.length);
				}
			}

Attachments (1)

test_ComboBox_2558.html (9.2 KB) - added by Douglas Hays 12 years ago.
test file

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by Douglas Hays

Attachment: test_ComboBox_2558.html added

test file

comment:1 Changed 12 years ago by haysmark@…

I have updated that code to check to see if the entered text begins the text of the 0th result.

comment:2 Changed 12 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.