Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid feedback stays hidden when use in a form group with a custom checkbox #26402

Closed
vpratfr opened this issue Apr 27, 2018 · 5 comments
Closed

Comments

@vpratfr
Copy link

vpratfr commented Apr 27, 2018

I have a custom checkbox which gets a validation error and the invalid-feedback div stays with display-none.

Below is the code generated. A message explaining why the checkbox must be checked is sometimes important.

<div class="form-group">
   <div class="custom-control custom-checkbox is-invalid" id="agree_terms_wrapper">
      <input class="custom-control-input is-invalid" type="checkbox" name="agree_terms" id="agree_terms" value="1">
      <label class="custom-control-label" for="agree_terms">I agree to the terms and conditions</label>
   </div>
   <div class="invalid-feedback">Terms and conditions must be carefully read and accepted. You cannot access our service otherwise.</div>
</div>
@morrissey-ingenious
Copy link
Contributor

morrissey-ingenious commented Apr 27, 2018

Your invalid-feedback div needs to be inside the the custom-control div

<div class="form-group">
   <div class="custom-control custom-checkbox is-invalid" id="agree_terms_wrapper">
      <input class="custom-control-input is-invalid" type="checkbox" name="agree_terms" id="agree_terms" value="1">
      <label class="custom-control-label" for="agree_terms">I agree to the terms and conditions</label>
       <div class="invalid-feedback">Terms and conditions must be carefully read and accepted. You cannot access our service otherwise.</div>
   </div>
</div>

@vpratfr
Copy link
Author

vpratfr commented Apr 27, 2018

Whops. My bad :/ I had skipped that part of the docs. Thanks.

@vpratfr vpratfr closed this as completed Apr 27, 2018
@racl101
Copy link

racl101 commented Mar 24, 2019

This Bootstrap 4 form validation error messages feature is insanely confusing and frustrating. I know so many people who have issues with it. It doesn't seem very intuitive. It was much simpler under BS3.

@matin-Walizada
Copy link

To fix this issue use class="invalid-feedback d-block"
it works perfect.

@kamilkahar90
Copy link

sorry if my comment a little bit late... just solved it by myself... u need to put form-control class in the input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants