WTForms how to use description paramter

289 views Asked by At

I have some simple boolean field and I want to add a short description. I specified a description parameter but it seems like no effecr. How it suppose to work at all?

from wtforms import BooleanField, Form


class AdminUsersForm(Form):
    foo = BooleanField(label='foo', default=True, description='foo')
<form method="GET">
    <div>
        {{ form.foo.label }}
        {{ form.foo(placeholder=checkbox.description)}}
        # No description impact at all, even tooltip.
    </div>
</form>

I found this answer but not sure that it's my case

1

There are 1 answers

0
Patrick Yoder On

You almost have it. Try changing your 'placeholder' to display the text that you have defined:

{{ form.foo(placeholder=form.foo.description)}}

You access this the same way as the form.label, simply by calling the parameter of the field of the form.