<form action="${form.action or '.'}" {% attrib id=form.html_id, enctype=form.enctype, class=form.class, method=form.method %}>
    {% if form.legend %}<legend>${form.legend}</legend>{% endif %}
    {%- if form.error %}
    <div class="alert alert-danger">${form.error}</div>
    {%- elif form.errors %}
    <div class="alert alert-danger">There are errors in the form, please check below.</div>
    {%- endif %}

    {%- for field in form.content.sections.fields %}
    {%- if field.visible %}
        <p{% if field.errors %} class="has-error"{% endif %}>
            {%- if field.label %}
            <label {% attrib class=[field.hidelabel ? 'sr-only': None] %} for="${field.id}">${field.label}</label>
            {%- endif %}
            {%- render field set style="simple" -%}
            {% include "common/helperror.html" from "moya.forms" %}
        </p>
    {%- else %}
        {% render field set style="simple" %}
    {%- endif %}
    {%- endfor %}
</form>
