Bug with autocomplete

101 views
Skip to first unread message

Suman Chakrabarti [MSFT]

unread,
May 12, 2011, 7:08:52 PM5/12/11
to KnockoutJS
Once a user has entered content into a field a few times, they may get
prompted with that content again. When selected, that content doesn't
update the view model, just the last few chars the user typed.

Example:

User has posted the following items:
Item 1 Test
Item 2 Test
Item 3 Test

The fourth time, the user decides to use the autocomplete box (Chrome/
Firefox/IE). The user types "Item", selects the item from the list,
and goes about his/her way. The only thing stored in the view model is
"Item", none of the rest of the data.

The only thing I can think of is to turn off autocomplete, but that's
not the best solution. Thanks!

fla...@gmail.com

unread,
May 13, 2011, 10:21:46 AM5/13/11
to KnockoutJS
Thanks for reporting this! I'm assuming you're using
"valueUpdate:'keydown'" or something like that, as that was the only
way I could reproduce it. Let me know if I'm wrong.

Filed as issue #102 (https://github.com/SteveSanderson/knockout/issues/
102) and fixed already in the latest source code version (https://
github.com/SteveSanderson/knockout/tree/master/build/output)

This fix ensures that "value" always catches "change" events, in
addition to "keydown" or whatever else you've asked it to catch. That
should account for whatever way the text box gets modified, as soon as
it loses focus.

Steve


On May 13, 12:08 am, "Suman Chakrabarti [MSFT]"
Reply all
Reply to author
Forward
0 new messages