<form id={{ visibleFields|keys|join|md5 }} class="prevent-double-submit" method="post" target="_self" data-request-uri="{{ requestURI }}">

    {%  if errors is not empty %}
    <span class=form-errors><br>
        {% for error in errors %} {{ error }} {% endfor %}
    </span>
    {% endif %}

    <table>
        {% for fieldName, field in visibleFields %}
            {{ field|write|raw }}
        {% endfor %}
    </table>

    <div class="form-actions">
        {% for action in actions %}
            {{ action|write|raw }}
        {% endfor %}
    </div>

</form>
<form id={{ visibleFields|keys|join|md5 }}
      class="prevent-double-submit {% if errors is not empty %}has-errors{% endif %}"
      method="post" target="_self" data-request-uri="{{ requestURI }}">

    {%  if errors is not empty %}
    <span class=form-errors><br>
        {% for error in errors %} {{ error }} {% endfor %}
    </span>
    {% endif %}

    <table>
        {% for fieldName, field in visibleFields %}
            {{ field|write|raw }}
        {% endfor %}
    </table>

    <div class="form-actions">
        {% for action in actions %}
            {{ action|write|raw }}
        {% endfor %}
    </div>

</form>
Add has-errors class to form with errors.
Add has-errors class to form with errors.
