How to specify rows and columns of a <textarea > tag using wtforms

Kevin Le - Khnle picture Kevin Le - Khnle · Feb 8, 2011 · Viewed 16.3k times · Source

Constructing a wtforms' TextAreaField is something like this:

content = wtf.TextAreaField('Content', id="content-area", validators=[validators.Required()])

How can I specify the number of rows and columns associated with this textarea?

Answer

Rasmus picture Rasmus · Feb 25, 2011

You are not supposed to do it in the place where you declare the widget. You have do it in the template. For eg:

{{form.content(rows='50',cols='100')}}

Need to ensure the rows and cols are specified as a string.