Fix duplicate labels on form inputs

It’s invalid HTML to have multiple labels nested within each other. This
was happening by accident because WTForms tries to be clever – when you
put `{{ field.label }}` in a template it prints a `<label>` tag for you,
not just the text of the label. But we put our own `<label>` tags in the
HTML to have more control of them.

This commit stops WTForms being so clever.
This commit is contained in:
Chris Hill-Scott
2017-02-13 09:50:26 +00:00
parent 4fe08d342a
commit 3f41090a94
5 changed files with 8 additions and 8 deletions

View File

@@ -11,7 +11,7 @@
<fieldset class="form-group{% if field.errors %} error{% endif %}" id="{{ field.name }}">
<legend>
<span class="form-label">
{{ field.label }}
{{ field.label.text }}
{% if hint %}
<span class="form-hint">
{{ hint }}