Trying to use flask-bootstrap quick_form.
HTML template my-form.j2:
{% import "bootstrap/wtf.html" as wtf %}
{% extends "layout.j2" %}
{% block content %}
<h1>My form</h1>
{{ wtf.quick_form(form) }}
{% endblock content %}
Form class:
class MyForm(FlaskForm):
"""A WTForm for configuring vehicle information"""
field1 = StringField('First field', [wtforms.validators.required()])
field2 = StringField('Second field', [wtforms.validators.required()])
field3 = StringField('Third field', [wtforms.validators.required()])
Form handler:
@app.route('/myform', methods=('GET', 'POST'))
def my_form():
form = MyForm()
if form.validate_on_submit():
myData = form.data
return redirect("/")
return render_template("my-form.j2", form=form)
Unfortunately I am not seeing a Submit button rendered, even if I add
{{ form.submit }}
to my table.
Any ideas?
I believe you can add the input field directly after
{{ wtf.quick_form(form) }}
and put both of these inside an HTML form:Example