This document is for an older version of
Freeform
. View latest version →Page object
The Page object contains all of the Rows assigned to it in the Composer. It also contains the index of the page and its label.
Properties
Methods
getRows()
#
Usage in Templates
Render the page label and its index:
{{ form.currentPage.label }}
{{ form.currentPage.index }}
1
2
2
Render all form pages and add a class to the currently shown page:
<ul>
{% for page in form.pages %}
<li>
{% if form.currentPage.index == page.index %}
<a href="javascript:;">{{ page.label }}</a>
{% else %}
{{ page.label }}
{% endif %}
</li>
{% endfor %}
</ul>
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Iterate through all rows and its fields of the current page:
{% for row in form.currentPage %}
<div class="row">
{% for field in row %}
<div class="field">
{{ field.label }}
</div>
{% endfor %}
</div>
{% endfor %}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Iterating over the form yields the same results:
{% for row in form %}
<div class="row">
{% for field in row %}
<div class="field">
{{ field.label }}
</div>
{% endfor %}
</div>
{% endfor %}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9