question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkboxes keeping checked class after unchecking

See original GitHub issue

Are you requesting a feature, reporting a bug or ask a question?

Reporting a bug

What is the current behavior?

When using checkboxes field, checking them will add a checked class to the div wrapping the label. However, when you uncheck the last checkbox (leaving nothing checked), the last box to be unchecked will still have a checked class applied to the div.

What is the expected behavior?

The checked class should be removed from any checkbox that is not checked.

How would you reproduce the current behavior (if this is a bug)?

Create a survey with a checkboxes field, check a checkbox, then uncheck. checked class will remain.

Provide the test code and the tested page URL (if applicable)

Tested page URL: https://codepen.io/benirose/pen/aGqVor (You’ll have to inspect elements to see the checked class still applied)

Specify your

  • browser: Chrome
  • browser version: 66
  • surveyjs platform (angular or react or jquery or knockout or vue): Vue
  • surveyjs version: 1.0.20

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
dmitrykurmanovcommented, May 17, 2018

@benirose please look at #1097 we’ve fixed it here (https://github.com/surveyjs/surveyjs/commit/a0ee7d971615a790954f6f167c6a00362d7bf8f7). Vue.delete and Vue.set methods does the trick. And the doc

1reaction
dmitrykurmanovcommented, May 10, 2018

Hello! This is not actually the bug. Survey data is hash table and Vue can’t correctly watch it out of the box. We need to create separate observable variable for it. Please check: https://codepen.io/dvadvk/pen/demRqX

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML checkboxes keep checked after refresh - Stack Overflow
If I refresh the page with Ctrl+Shift+R everything is OK - the page renders unchecked check boxes, however if some of them were...
Read more >
Quick Tip: Persist Checkbox Checked State after Page Reload
This quick tip describes how to have your browser remember the state of checkboxes once a page has been refreshed or a user...
Read more >
Check or Uncheck all in a group of checkbox in JavaScript
If we have a series or a group of check boxes then we can provide one button ... This way the user in...
Read more >
<input type="checkbox"> - HTML: HyperText Markup Language
In this example we keep track of the ingredients we are collecting for a recipe. When you check or uncheck an ingredient's checkbox, ......
Read more >
Indeterminate Checkboxes - CSS-Tricks
Checkbox inputs can only have two states: checked or unchecked. They can have any value, but they either submit that value (checked) or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found