Opened 8 years ago

Closed 8 years ago

#10090 closed (duplicate)

small error in example code for looping over hidden form fields

Reported by: casey Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


<form action="/contact/" method="POST">

{% for field in form.visible_fields %}

<div class="fieldWrapper">

{# Include the hidden fields in the form #}
{% if forloop.first %}

{% for hidden in form.hidden_fields %}
{{ field }}
{% endfor %}

{% endif %}

{{ field.errors }}
{{ field.label_tag }}: {{ field }}


{% endfor %}
<p><input type="submit" value="Send message" /></p>


This is from "Looping Over Hidden and Visible Fields" at There is an error in the inner for loop foir hidden fields. In this loop, "{{field}}"" should be "{{hidden}}" to reflect the variable name in the inner loop.

Change History (1)

comment:1 Changed 8 years ago by Alex Gaynor

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: duplicate
Status: newclosed

Closing as a dupe of #10009.

Note: See TracTickets for help on using tickets.
Back to Top