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

Checkbox does not preserve checked status #510

Closed
scottburch opened this Issue Nov 28, 2012 · 11 comments

Comments

Projects
None yet
2 participants
@scottburch

scottburch commented Nov 28, 2012

I have a checkbox in a form. On re-render a checked checkbox is no longer checked.

This appears to be the offending code:

if (tgt.checked === true && src.checked === false) {
  tgt.checked = false;
}

Although this code makes sense. For some reason before this code src.checked is false and tgt.checked is true. Of course, this code changes that. Removing this code solves the issue, however, this code is in here for a reason. It is unclear as to why src.checked is false.

@glasser

This comment has been minimized.

Member

glasser commented Nov 28, 2012

This might be related to the work I'm doing on the spark-original-value branch, although I haven't really focused on checked yet.

@scottburch

This comment has been minimized.

scottburch commented Nov 28, 2012

I thought that might be true. I merged in that branch and tested it, but I did not know if you were still working on it. I'll wait. Thanks

@glasser

This comment has been minimized.

Member

glasser commented Nov 28, 2012

Give it another shot? I've just pushed another commit (c03ca91) to spark-original-value which tries to preserve CHECKED in a better way. Let me know if it matches your expectation!

@scottburch

This comment has been minimized.

scottburch commented Nov 28, 2012

Works great. Thanks

@scottburch

This comment has been minimized.

scottburch commented Nov 28, 2012

Actually, I tried it again. It preserved the checkbox the first re-render, but not the second.

@glasser

This comment has been minimized.

Member

glasser commented Nov 28, 2012

OK, can you give more details here? eg, is the checkbox always rendered the same way by the code, or does that change too? What does the user do? Ideally a code sample plus reproduction steps...

@scottburch

This comment has been minimized.

scottburch commented Nov 28, 2012

git://github.com/scottburch/meteor-checkbox-test.git. Instructions to reproduce are included in the body.

@glasser

This comment has been minimized.

Member

glasser commented Nov 28, 2012

OK, great, the latest spark-original-value (30f7f57) should fix that! Thanks for the reproduction, it was very helpful.

@glasser glasser closed this Nov 28, 2012

@glasser

This comment has been minimized.

Member

glasser commented Nov 28, 2012

Hopefully this'll end up devel by the end of the week or early next week (Spark changes can be subtle and require careful review...)

glasser added a commit that referenced this issue Nov 28, 2012

@scottburch

This comment has been minimized.

scottburch commented Nov 28, 2012

Not to slow you down. Just tested in my project and it works fine. Thanks.

@glasser

This comment has been minimized.

Member

glasser commented Nov 28, 2012

Great to hear!

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