Hi I have been trying to pepopulate a textareafield using something like this in the template.
{{form.content(value="please type content")}}
This works when the field is textfield primarily because the html accepts value for <input type="text">
but the same does not work for textarea... Can someone please help me with this?
You can do it before rendering, something like:
form.content.data = 'please type content'
I'm new to WTForms though.
For textarea
widgets, you set the default content with the default
argument in your field constructors.
class YourForm(Form): your_text_area = TextAreaField("TextArea", default="please add content")
Then when you render:
{{form.content()}}
WTForms will render the default text. I have not been able to find a way to specify default text for the text area at render time.
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