{% if mode == "table" %}
    {% if data|first|length > 0 %}
        <table id="coach_output_format_data_{{ formid }}" class="table table-striped table-hover">
            {% if title is not empty %}
                <thead>
                    {% for t in title %}
                        <th>{{ t }}</th>
                    {% endfor %}
                    {% if title|length < data|first|length %}
                        {% for i in title|length..data|first|length-1 %}
                            <th>&nbsp;</th>
                        {% endfor %}
                    {% endif %}
                </thead>
            {% endif %}
            <tbody>
                {% for row in data %}
                    <tr>
                        {% for formfield in row %}
                            {% if formfield.getFormdata() is not empty %}
                                <td class="output_list_data">
                                    {% if formfield.getFormdata().dataIsArray() %}
                                        {% for d in formfield.getFormdata.getDataJsonDecoded() %}
                                            {{ d|nl2br }}&nbsp;
                                        {% endfor %}
                                    {% else %}
                                        {{ formfield.getFormdata().getData()|nl2br }}
                                    {% endif %}
                                </td>
                            {% else %}
                                <td>
                                    {% if placeholder is not null %}
                                        <small>{{ placeholder }}</small>
                                    {% else %}
                                        &nbsp;
                                    {% endif %}
                                </td>
                            {% endif %}
                        {% endfor %}
                        {% if row|first|length < title|length %}
                            {% for i in row|first|length..title|length-1 %}
                                <td>&nbsp;</td>
                            {% endfor %}
                        {% endif %}
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}
{% elseif mode == "text" %}
    {% if data|first|length > 0 %}
        <p id="coach_output_format_data_{{ formid }}">
            {% if title is not empty %}
                <b>
                    {% for t in title %}
                        {{ t }}&nbsp;
                    {% endfor %}
                </b>
                <br>
            {% endif %}
            {% for row in data %}
                {% for formfield in row %}
                    {% if formfield.getFormdata() is not empty %}
                        {% if formfield.getFormdata().dataIsArray() %}
                            {% for d in formfield.getFormdata.getDataJsonDecoded() %}
                                <i>{{ d|nl2br }}&nbsp;</i>
                            {% endfor %}
                        {% else %}
                            <i>{{ formfield.getFormdata().getData()|nl2br }}&nbsp;</i>
                        {% endif %}
                    {% else %}
                        {% if placeholder is not null %}
                            <small>{{ placeholder }}</small>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            {% endfor %}
        </p>
    {% endif %}
{% elseif mode == "list" %}
    {% if title is not empty %}
        <p>
            <b>
                {% for t in title %}
                    {{ t }}&nbsp;
                {% endfor %}
            </b>
            <br>
        </p>
    {% endif %}
    <ul id="coach_output_format_data_{{ formid }}" class="schriftgroesse ts-form-output-list list-unstyled">
        {% for row in data %}
            {% for formfield in row %}
                {% if formfield.getFormdata() is not empty %}
                    <li class="output_list_data mb-1">
                        {% if formfield.getFormdata().dataIsArray() %}
                            {% for d in formfield.getFormdata.getDataJsonDecoded() %}
                                {{ d|nl2br }}&nbsp;
                            {% endfor %}
                        {% else %}
                            {{ formfield.getFormdata().getData()|nl2br }}&nbsp;
                        {% endif %}
                    </li>
                {% else %}
                    {% if placeholder is not null %}
                    <li>
                        <small>{{ placeholder }}</small>    
                    </li>
                    {% endif %}
                {% endif %}
                </li>
            {% endfor %}
        {% endfor %}
    </ul>
{% endif %}