New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two-way binding bug regarding select dropdowns when value is set in inserted or init #2134

Closed
halcyonandon opened this Issue Dec 10, 2015 · 2 comments

Comments

Projects
None yet
5 participants
@halcyonandon

halcyonandon commented Dec 10, 2015

http://jsfiddle.net/sjxsazoh/3/

{^$value}="countryCode" - Works
{($value)}="countryCode" - Doesn't work
can-value="{countryCode}" - No longer works

@pYr0x

This comment has been minimized.

Show comment
Hide comment
@pYr0x

pYr0x Dec 11, 2015

dont know which behavior you expect?
in the first dropdown
<select class="country-list" {^$value}="countryCode" name="countryCode" id="countryCode">
you export the element value to countryCode with a one-way-binding.

if you change this to:
<select class="country-list" {(^$value)}="countryCode" name="countryCode" id="countryCode">
all three dropdowns change simultaneously

pYr0x commented Dec 11, 2015

dont know which behavior you expect?
in the first dropdown
<select class="country-list" {^$value}="countryCode" name="countryCode" id="countryCode">
you export the element value to countryCode with a one-way-binding.

if you change this to:
<select class="country-list" {(^$value)}="countryCode" name="countryCode" id="countryCode">
all three dropdowns change simultaneously

@dylanrtt

This comment has been minimized.

Show comment
Hide comment
@dylanrtt

dylanrtt Dec 11, 2015

Contributor

@pYr0x The issue being demonstrated is that changes to viewModel properties during events.init() or events.inserted() do not update <select> elements using the new 2.3 binding rules. The 2nd and 3rd select menus should show "INDIA" initially, not "USA". It works in his 1st example because it's using stache bindings to determine the selected element.

Here's a slightly simplified example:
http://jsbin.com/fizuniyoju/edit?html,js,output

The bug affects can-value as well because it shares code with the new bindings.

It doesn't seem to be a problem with other form controls. There are a few open issues about select element live binding already; they sure could use some love.

Contributor

dylanrtt commented Dec 11, 2015

@pYr0x The issue being demonstrated is that changes to viewModel properties during events.init() or events.inserted() do not update <select> elements using the new 2.3 binding rules. The 2nd and 3rd select menus should show "INDIA" initially, not "USA". It works in his 1st example because it's using stache bindings to determine the selected element.

Here's a slightly simplified example:
http://jsbin.com/fizuniyoju/edit?html,js,output

The bug affects can-value as well because it shares code with the new bindings.

It doesn't seem to be a problem with other form controls. There are a few open issues about select element live binding already; they sure could use some love.

@justinbmeyer justinbmeyer added the bug label Dec 11, 2015

@justinbmeyer justinbmeyer self-assigned this Dec 11, 2015

@justinbmeyer justinbmeyer added this to the 2.3.6 milestone Dec 11, 2015

@daffl daffl removed this from the 2.3.6 milestone Dec 12, 2015

@justinbmeyer justinbmeyer added this to the 2.3.7 milestone Dec 12, 2015

@daffl daffl closed this in #2139 Dec 16, 2015

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