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

前端 未结 9 1943
暗喜
暗喜 2021-02-18 22:40

Constructing a wtforms\' TextAreaField is something like this:

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


        
9条回答
  •  广开言路
    2021-02-18 23:21

    There is a tutorial on Flask by nettuts+. Basically, it works like this:

    from flask.ext import wtf
    
    class ContactForm(wtf.Form):
        content = wtf.TextAreaField("Content", [validators.Required()])
    

    and in your html:

    {{ form.content }}

    Instead of specifying the layout in html, you can specify it in your css, for example:

    form textarea#content {
         width: 100px;
         height: 100px;
         max-width: 100px;
    }
    

提交回复
热议问题