Skip to content

Commit

Permalink
Add support for custom attributes in form tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredopironti authored and mbr committed Feb 19, 2017
1 parent 9308ab9 commit af52b97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit af52b97

Please sign in to comment.