Bug Tracker

Ticket #3228 (new bug)

Opened 4 months ago

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

Reported by: jose.raya Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.3 Component: plugin
Version: 1.2.6 Keywords:
Cc: Needs: Review

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

Note: See TracTickets for help on using tickets.