B-form-checkbox-group required attribute makes all boxes required
See original GitHub issueDescribe the bug
B-form-checkbox-group required makes all boxes required.
Steps to reproduce the bug
Put required
attribute on b-form-checkbox-group
in a form
tag. Unless you select all boxes you can’t submit form because of validation error.
Expected behavior
Select one of the options and be able to submit form.
Versions
Libraries:
- BootstrapVue: 2.13.0
- Bootstrap: 4.4.1
- Vue: 2.6.11
Environment:
- Device: Mac
- OS: macOS
- Browser: Chrome
- Version: 80.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Form Checkbox | Components - BootstrapVue
<b-form-checkbox-group> components render inline checkboxes by default, ... Boolean, false, Adds the `required` attribute to the form control.
Read more >Form Checkbox | BootstrapVue 3 - cdmoro
All <b-form-checkbox> components tied to the same v-model must have the same name . The name is required in order for Assistive Technologies...
Read more >Using the HTML5 "required" attribute for a group of checkboxes?
This is jQuery code that can exploit the html5 validation by changing the required properties if any one is checked. Following is your...
Read more >Form Checkbox | Components | BootstrapVue
When binding multiple checkboxes together, you must set the name prop to the same value for all <b-form-checkbox> s in the group individually...
Read more >required - CSS-Tricks
style all input elements with a required attribute ... On checkboxes, makes each individual checkbox required (to be checked).
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 FreeTop 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
Top GitHub Comments
You could potentially do something like this, this should remove the required attribute from the checkboxes once one option have been selected.
Got it. Well, so there you have a potentially new feature to think about - I think many users would appreciate html-based any-checkbox validation. Or even something like
:required="numberOfRequiredChecks"
(basically the same as @Hiws solution). Anyway, thanks for fast reply!