diff --git a/crispy_bootstrap5/templates/bootstrap5/layout/switch.html b/crispy_bootstrap5/templates/bootstrap5/layout/switch.html index add30a6..68b0629 100644 --- a/crispy_bootstrap5/templates/bootstrap5/layout/switch.html +++ b/crispy_bootstrap5/templates/bootstrap5/layout/switch.html @@ -4,6 +4,7 @@ {{ field }} {% else %} <{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="mb-3 form-check form-switch{% if 'form-horizontal' in form_class %} row{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}"> +
{% if field.errors %} {% crispy_field field 'class' 'form-check-input is-invalid' 'role' 'checkbox' %} {% else %} @@ -13,5 +14,6 @@ {{ field.label }} {% include 'bootstrap5/layout/help_text_and_errors.html' %} +
{% endif %}