flask-bootstrap icon indicating copy to clipboard operation
flask-bootstrap copied to clipboard

`description` property isn't rendered for `BooleanField`

Open shnela opened this issue 5 years ago • 2 comments

I have following form definition:

class Form(FlaskForm):
    text = StringField(description='Some visible text')
    unique = BooleanField(description="Won't be rendered")

And below I'm presenting how does html rendered by following template loooks like:

{% for field in form %}
    {{ wtf.form_field(field) }}
{% endfor %}
<div class="form-group "><label class="form-control-label" for="text">Text</label>
        <input class="form-control" id="text" name="text" type="text" value="">
        <small class="form-text text-muted">Some visible text</small>
</div>
<div class="form-check">
      <label class="form-check-label">
      <input class="form-check-input" id="unique" name="unique" type="checkbox" value="y">
Unique
     </label>
</div>

Here's how it looks like live: image

Why isn't description for BooleanField rendered?

I'm using Flask-Bootstrap4

shnela avatar Oct 22 '19 16:10 shnela

It looks like checkbox field is rendered separately here, but descriptor field is rendered for other field types only here.

Would be someone interested in merging pull request if I've fixed that?

shnela avatar Feb 05 '20 16:02 shnela

And workaround if someone needed:

class Form(FlaskForm):
    text = StringField(description='Some visible text')
    unique = BooleanField(label='Unique - <small>Bow this "description" is visible</small>')

shnela avatar Feb 05 '20 17:02 shnela