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

bootstrap_field field form_check_class doesn't overwrite the default checkbox class #290

Open
ClintGit opened this issue May 9, 2021 · 1 comment

Comments

@ClintGit
Copy link

ClintGit commented May 9, 2021

Tried the following:
<form method="POST" action="{% url 'myauth:account_signup' %}">
{% csrf_token %}
{% for field in signup_form %}
{% if field.name == 'sign-agree-check' %}
{% bootstrap_field field form_check_class='checkmark' show_label=False %}
{% else %}
{% bootstrap_field field show_label=False field_class='m-0 p-0' form_group_class='m-0 p-0' label_class='m-0 p-0' %}
{% endif %}
{% endfor %}
<button type="submit" class="site-btn">Register Now</button>
</form>

This is the HTML that is rendered:
<div class="form-group">
<div class="form-check">
<input type="checkbox" name="sign-agree-check" id="sign-agree-check" class="form-check-input" required="">
<label class="form-check-label" for="sign-agree-check">
I agree to the terms &amp; conditions
</label>
</div>
</div>

@crazyscientist
Copy link

crazyscientist commented Aug 23, 2021

I can confirm this.

Using the template tag like this never changes the rendered class:

{% bootstrap_field form.myfield form_check_class='btn btn-primary' show_help=False %}

always results in the class being form-check

<div class="form-group is-valid">
  <div class="form-check">
    <input ...>
    <label class="form-check-label" ...>.....</label>
  </div>
</div>

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