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

form-control css class added to checkbox when form_show_labels == False #5

Closed
powderflask opened this issue Jan 7, 2024 · 0 comments

Comments

@powderflask
Copy link
Contributor

A Checkbox input should not have the form-control css class as bootstrap3 adds height=34px to form-control elements.

crispy-forms 1.14 introduced a bug in bootstrap3/field.html template that causes the form-control css class to be added to the input element when form_show_labels == False

To reproduce, create a form with:

my_checkbox = forms.BooleanField(required=False, widget=forms.CheckboxInput())
form.helper.form_show_labels = False

Rendered field has form-control css class, which styles a form-control-sized checkbox 34px tall.

Use case: a formset view where items can be selected (i.e., each checkbox has no label)

This is easy to fix. I'll follow up with a PR shortly.

powderflask added a commit to powderflask/crispy-bootstrap3 that referenced this issue Jan 7, 2024
handle case where checkbox is rendered without label.

regression test added: test fails in 2022.1 passes with this fix.
powderflask added a commit to powderflask/crispy-bootstrap3 that referenced this issue Jan 9, 2024
handle case where checkbox is rendered without label.

regression test added: test fails in 2022.1 passes with this fix.
smithdc1 pushed a commit to powderflask/crispy-bootstrap3 that referenced this issue Jan 9, 2024
handle case where checkbox is rendered without label.

regression test added: test fails in 2022.1 passes with this fix.
@smithdc1 smithdc1 closed this as completed Jan 9, 2024
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

2 participants