Because of the way the Bootstrap style rules are set up, the way checkbox elements are currently structured results in the associated error text remaining hidden.
Right now, the resulting HTML structure when a checkbox form element has an associated error is:
<div class="form-group has-danger">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="check" class="custom-control-input is-invalid">
<label class="custom-control-label" for="check">Label text</label>
</div>
<div id="check_error_0" class="invalid-feedback">Error text</div>
</div>
but it needs to be
<div class="form-group has-danger">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="check" class="custom-control-input is-invalid">
<label class="custom-control-label" for="check">Label text</label>
<div id="check_error_0" class="invalid-feedback">Error text</div>
</div>
</div>
That is, the invalid-feedback div needs to be a subsequent sibling of the is-invalid input.
The relevant Bootstrap rules are
.invalid-feedback {
display: none;
...
}
.was-validated :invalid ~ .invalid-feedback,
.was-validated :invalid ~ .invalid-tooltip,
.is-invalid ~ .invalid-feedback,
.is-invalid ~ .invalid-tooltip {
display: block;
}
Because of the way the Bootstrap style rules are set up, the way checkbox elements are currently structured results in the associated error text remaining hidden.
Right now, the resulting HTML structure when a checkbox form element has an associated error is:
but it needs to be
That is, the
invalid-feedbackdiv needs to be a subsequent sibling of theis-invalidinput.The relevant Bootstrap rules are