Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom attributes in form tags. #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Form macro reference
horizontal_columns=('lg', 2, 10),\
enctype=None,\
button_map={},\
id="")
id="",\
render_kw={})

Outputs Bootstrap-markup for a complete Flask-WTF_ form.

Expand All @@ -58,6 +59,8 @@ Form macro reference
in the ``button_map`` will use the ``default`` type of
button.
:param id: The ``<form>`` id attribute.
:param render_kw: A dictionary, specifying custom attributes for the
``<form>`` tag.

.. py:function:: form_errors(form, hiddens=True)

Expand Down
4 changes: 3 additions & 1 deletion flask_bootstrap/templates/bootstrap/wtf.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@
enctype=None,
button_map={},
id="",
novalidate=False) %}
novalidate=False,
render_kw={}) %}
{#-
action="" is what we want, from http://www.ietf.org/rfc/rfc2396.txt:

Expand Down Expand Up @@ -196,6 +197,7 @@
{%- if _enctype[0] %} enctype="{{_enctype[0]}}"{% endif -%}
{%- if role %} role="{{role}}"{% endif -%}
{%- if novalidate %} novalidate{% endif -%}
{%- if render_kw %} {{render_kw|xmlattr}}{% endif -%}
>
{{ form.hidden_tag() }}
{{ form_errors(form, hiddens='only') }}
Expand Down