Flask-wtf submit format button using bootstrap
I am using jinja to render the flask-wtf submit button like this:
{{ wtf.form_field(form.submit) }}
The result is a button formatted with the btn-default bootstrap format (white). I would like to change this to btn-success upload format (green).
How can I achieve this?
+3
zanzu
source
to share
3 answers
I assume you are using flash bootstrap as well.
On Jinja2 macros with flash bootstrap you have:
{% call _hz_form_wrap(horizontal_columns, form_type, True, required=required) %}
{{field(class='btn btn-%s' % button_map.get(field.name, 'default'), **kwargs)}}
{% endcall %}
You should use if you can click button_map [see. details in the comments below]
+2
dpgaspar
source
to share
As suggested by @dpgaspar, the solution was to use button_map like this:
{{ wtf.form_field(form.submit, button_map={'submit':'success'}) }}
+4
zanzu
source
to share
If you are using wtf.quick_form use a form like this.
{{ wtf.quick_form(form, button_map={'submit':'success'}) }}
+1
Waqar detho
source
to share