Skip to content

Commit

Permalink
Form action finally settled on "". Fixes #97 (and #39).
Browse files Browse the repository at this point in the history
  • Loading branch information
mbr committed Jun 23, 2015
1 parent f6ca454 commit c207420
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Flask-Bootstrap Changelog

The following changes are not fully backwards compatible:

3.3.5.2
-------
* ``action`` finally settled on ``""``.

3.3.5.1
-------

Expand Down
22 changes: 20 additions & 2 deletions flask_bootstrap/templates/bootstrap/wtf.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

{# valid form types are "basic", "inline" and "horizontal" #}
{% macro quick_form(form,
action=".",
action="",
method="post",
extra_classes=None,
role="form",
Expand All @@ -138,6 +138,24 @@
enctype=None,
button_map={},
id="") %}
{#-
action="" is what we want, from http://www.ietf.org/rfc/rfc2396.txt:

4.2. Same-document References

A URI reference that does not contain a URI is a reference to the
current document. In other words, an empty URI reference within a
document is interpreted as a reference to the start of that document,
and a reference containing only a fragment identifier is a reference
to the identified fragment of that document. Traversal of such a
reference should not result in an additional retrieval action.
However, if the URI reference occurs in a context that is always
intended to result in a new request, as in the case of HTML's FORM
element, then an empty URI reference represents the base URI of the
current document and should be replaced by that URI when transformed
into a request.

-#}
{#- if any file fields are inside the form and enctype is automatic, adjust
if file fields are found. could really use the equalto test of jinja2
here, but latter is not available until 2.8
Expand All @@ -157,7 +175,7 @@
{% set _ = _enctype.append(enctype) %}
{%- endif %}
<form
{%- if action %} action="{{action}}"{% endif -%}
{%- if action != None %} action="{{action}}"{% endif -%}
{%- if id %} id="{{id}}"{% endif -%}
{%- if method %} method="{{method}}"{% endif %}
class="form
Expand Down

0 comments on commit c207420

Please sign in to comment.