How to render my TextArea with WTForms?

Very old question, but since the WTF-Form documentation isn’t clear I’m posting my working example. OP, hope you are not still working on this. 🙂

form

from flask_wtf import Form
from wtforms.fields import StringField
from wtforms.widgets import TextArea

class PostForm(Form):
    title = StringField(u'title', validators=[DataRequired()])
    body = StringField(u'Text', widget=TextArea())

template

{% extends "base.html" %}
{% block title %}Create Post{% endblock %}
{% block content %}
<H3>Create/Edit Post</H3>
<form action="" method=post>
   {{form.hidden_tag()}}
   <dl>
      <dt>Title:
      <dd>{{ form.title }}
      <dt>Post:
      <dd>{{ form.body(cols="35", rows="20") }}}
   </dl>
   <p>
      <input type=submit value="Publish">
</form>
{% endblock %}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)