Select List Without Options Doesn't Update Observable #460

Merged
merged 2 commits into from May 15, 2012

Projects

None yet

3 participants

@cblaze22

http://stackoverflow.com/questions/10402042/knockout-js-not-working-when-select-list-doesnt-have-options

I think I found a bug in knockout.js in conjuction with the asp.net mvc dropdownlist. When supplying just a list of strings MVC doesn't render the option values on the select element. Knockout.js won't update the value because of this. If I use the second html snippet below by explicitly telling it properties it works. Shouldn't knockout.js read the inner html if the options value isn't available?

@mbest
Knockout.js member

Ready for merge.

@mbest mbest referenced this pull request May 14, 2012
Closed

2.2 release discussion #479

@mbest mbest #460 - Always use value attribute, if specified, even if blank.
Add spec to show that a blank value will be used instead of the option text. Modern browsers automatically set element.value to the text if the value attribute is missing. IE<=7 doesn't and also makes it kind of hard to tell of the value attribute is set or not.
fb0e4c4
@mbest
Knockout.js member

Updated:

Always use value attribute, if specified, even if blank.

  • Add spec to show that a blank value will be used instead of the option text.
  • Modern browsers automatically set element.value to the text if the value attribute is missing. IE<=7 doesn't and also makes it kind of hard to tell if the value attribute is set or not.
@SteveSanderson SteveSanderson merged commit fb0e4c4 into master May 15, 2012
@SteveSanderson

Nice one - thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment