Skip to content

get validation to work for bootstrap 4 #1

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

Merged
merged 1 commit into from
Jun 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions flask_bootstrap/templates/bootstrap/wtf.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{%- if bootstrap_is_hidden_field(form[fieldname]) and hiddens or
not bootstrap_is_hidden_field(form[fieldname]) and hiddens != 'only' %}
{%- for error in errors %}
<div class="invalid-feedback">{{error}}</div>
<div class="invalid-feedback d-block">{{error}}</div>
{%- endfor %}
{%- endif %}
{%- endfor %}
Expand Down Expand Up @@ -108,7 +108,7 @@
{%- if field.errors %}
{%- for error in field.errors %}
{% call _hz_form_wrap(horizontal_columns, form_type, required=required) %}
<div class="invalid-feedback">{{error}}</div>
<div class="invalid-feedback d-block">{{error}}</div>
{% endcall %}
{%- endfor %}
{%- elif field.description -%}
Expand All @@ -118,15 +118,23 @@
{%- endif %}
{%- else -%}
{{field.label(class="form-control-label")|safe}}
{% if field.type == 'FileField' %}
{{field(class="form-control-file", **kwargs)|safe}}
{%- if field.errors %}
{% if field.type == 'FileField' %}
{{field(class="form-control-file is-invalid", **kwargs)|safe}}
{% else %}
{{field(class="form-control is-invalid", **kwargs)|safe}}
{% endif %}
{% else %}
{{field(class="form-control", **kwargs)|safe}}
{% if field.type == 'FileField' %}
{{field(class="form-control-file", **kwargs)|safe}}
{% else %}
{{field(class="form-control", **kwargs)|safe}}
{% endif %}
{% endif %}

{%- if field.errors %}
{%- for error in field.errors %}
<div class="invalid-feedback">{{error}}</div>
<div class="invalid-feedback d-block">{{error}}</div>
{%- endfor %}
{%- elif field.description -%}
<small class="form-text text-muted">{{field.description|safe}}</small>
Expand Down