When using the following form:
class TextForm(Form):
example = RadioField('Choice 1:', choices=[('A','Option A'),('B','Option B')])
key = RadioField('Choice 2:', choices=[('1', 'Option 1'), ('2', 'Option 2')])
submit = SubmitField('Submit')
I am expecting to see:
Choice 1:
Choice 2:
Instead I am getting no labels as follows:
What am I missing?
I just had the same issue.
It might be intended by the author of "quick_form" macro, or more likely he/she missed a line of code to render out the label of RadioField, as the same is done for other types of fields.
To hack it, locate the file "bootstrap/wtf.html", where macro "quick_form" is defined.
add this line:
{{field.label(class="control-label")|safe}}
before the "for" loop:
{% for item in field -%}
<div class="radio">
<label>
{{item|safe}} {{item.label.text|safe}}
</label>
</div>
{% endfor %}
Hope this works for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With