v-bind="$attrs" and problems with "value" attribute for multi-checkboxes
See original GitHub issueVersion
2.5.16
Reproduction link
https://codepen.io/anon/pen/aYqoYL?editors=1010
Steps to reproduce
- Check the checkbox
- See that the value is set to “null” even though the input element has its value (correctly) set to “foo”
What is expected?
- The value passed through “$attrs” should be the checkbox’s value used
(or, the value
never hits the DOM element, the fact that it is present on the DOM element but isn’t used in the model is a conflict IMO)
What is actually happening?
- Null is set
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
Why do we need the value attribute for checkbox inputs? - HTML
So the short answer is; no, it wouldn't cause a problem if there are multiple checkboxes with the same name value, and in...
Read more >Required attribute on multiple checkboxes with the same name?
i had the same problem, my solution was apply the required attribute to all elements <input type="checkbox" name="checkin_days[]" ...
Read more >Class Laminas\Form\Element\MultiCheckbox
Methods ; setAttributes(), Set many attributes at once, Element ; setChecked(), Checks or unchecks the checkbox. Checkbox ; setCheckedValue(), Set the value to...
Read more >Attribute selectors - CSS: Cascading Style Sheets | MDN
Represents elements with an attribute name of attr whose value is a whitespace-separated list of words, one of which is exactly value.
Read more >HTML | value Attribute - GeeksforGeeks
Difficulty Level : Basic; Last Updated : 30 Nov, 2021 ... The value attribute in HTML is used to specify the value of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I get your point, but I’m not sure if this is a bug or not. We need some feedback from the core team.
My solution is partly based on this example code, where
value
is bound explicit and used with disabled attribute inheritance. source@emanuelmutschlechner - please read my previous response. With
$attrs
this shouldn’t be necessary. I’m pretty confident this is a valid bug, but I appreciate you trying to help.