python - Line wrapping in HTML forms using Flask -


i struggling text fields in flask. want achieve line wrapping in html forms. tried different suggestions found in related html-threads without luck.

e.g., let's assume have simple flask app text field, , want wrap text instead of extending right:

enter image description here

my flask app looks this:

from flask import flask, render_template, request wtforms import form, textfield, validators  app = flask(__name__)  class reviewform(form):     moviereview = textfield('my review: ', [validators.datarequired()])  @app.route('/') def index():     form = reviewform(request.form, csrf_enabled=false)     return render_template('reviewform.html', form=form)  if __name__ == '__main__':     app.run(debug=true) 

and template should render written this:

./templates/reviewform.html

<!doctype html> <html>   <head>   </head>   <body>   <form method=post action="/results">   <dl>     {{ form.review(style="padding: 0 0 100px 0; cols='5'; wrap='soft'") }}   </dl>   <div style='padding-left:40px;'>       <input type=submit value='submit' name='submit_btn'>    </div> </form>   </body> </html> 

the textfield input type="text", doesn't support word wrap. cols , wrap not working @ all. think need textareafield:

from wtforms import form, textareafield, validators  class reviewform(form):     review = textareafield('my review: ', [validators.datarequired()]) 

this make textarea has word-wrap support.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -