Bootstrap Form Validation with Multiple Checkboxes (At least 4 have to be selected)

Viewed 191

What I'm Implementing:

I'm implementing Bootstrap's From and checkboxes, but I want to give the user an error if less than 4 checkboxes are selected. I'm using React (react-bootstrap) and I could use the required prop, but that would mean all checkboxes would be required.

My problem:

As of now, there's no form validation and when the user hits submit without checking any of the boxes (The form won't submit for other required fields), so the checkbox input labels are now green. How do I also get those to show red when at least 4 checkboxes are not checked?

0 Answers
Related