Flask Wtf.quick_form Running Some Javascript And Setting A Form Variable
I am creating blog posts and have so far done it with a normal html form. One funky think I was doing was running javascript onclick and setting a hidden variable in the form with
Solution 1:
Here is a very simple example of how to create a form with Flask-Bootstrap using WTForms (as it appears you are doing this in your code):
<form class="form form-horizontal" method="post" role="form">
{{ form.hidden_tag() }}
{{ wtf.form_errors(form, hiddens="only") }}
{{ wtf.form_field(form.field1) }}
{{ wtf.form_field(form.field2) }}
</form>
The above is manually. Here is without thinking:
{{ wtf.quick_form(form) }}
To answer your question, well that is hard to do because you haven't shown us any errors. But one thing is that
$("#new_entry_submit_button")
is a jQuery selector for an id
attribute. To set that in Flask-Bootstrap either use:
{{ wtf.quick_form(form, id="whatever") }}
Or:
<form class="form form-horizontal" method="post" role="form">
{{ form.hidden_tag() }}
{{ wtf.form_errors(form, hiddens="only") }}
{{ wtf.form_field( form.field1(id='whatever') ) }}
{{ wtf.form_field(form.field2) }}
</form>
Post a Comment for "Flask Wtf.quick_form Running Some Javascript And Setting A Form Variable"