'WTForms how to use description paramter
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
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |