2
votes

I have a text input field bound to a viewmodel using a Knockout.js value binding. In IE9 if I type in the first few letters of my username, I get the standard auto-complete dropdown. Selecting my username from the auto-complete does not update my viewmodel. Is there a way to trigger an update to my observable from an auto-complete selection?

<input type="text" data-bind="value: userName" />
3

3 Answers

7
votes

Upgrading to 2.1.0 as suggested by Richard's answer fixed my problem, so I have marked it as the answer.

For anyone needing this to work in Knockout 2.0.0, setting valueUpdate to 'blur' seems to work as well.

<input type="text" data-bind="value: userName, valueUpdate: 'blur'" />
3
votes

This issue was submitted as a bug 1 year ago:

https://github.com/SteveSanderson/knockout/pull/122

It seems a fix been included in the 2.1.0 version of knockout.js - so if you update it should fix this issue for you.

If this is not possible, an alternative suggestion is to just turn autocomplete off on your username <input> using the attribute autocomplete="off"

0
votes

It is working for me valueUpdate: 'blur' with ko_autocomplete in knockout