Skip to main content

Bug Tracker

Side navigation

#3228 closed bug (invalid)

Opened August 07, 2008 09:10AM UTC

Closed October 12, 2009 11:34PM UTC

[autocomplete] MustMatch does not work if entry has white spaces at the end

Reported by: jose.raya Owned by:
Priority: major Milestone: 1.3
Component: plugin Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:
Description

If mustMatch is activated we have found that, when the entry contains a white space at the end, once we select the value from the list it is rejected.

We have found the problem and it is in the search event:

At line 184 you trim the value of the input:

$.each(trimWords($input.val()), function(i, value) {

request(value, findValueCallback, findValueCallback);

});

but when you compare with the value in the list (line 175) you don't trim the list value:

if( data[i].result.toLowerCase() == q.toLowerCase() ) {

result = data[i];

break;

}

As a result of this, the value in the input field is not found in the list and is rejected.

The solution that works for us is to trim the list value before comparing:

if( trimWords(data[i].result).toLowerCase() == q.toLowerCase() ) {

result = data[i];

break;

}

Attachments (0)
Change History (1)

Changed October 12, 2009 11:34PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .