{% macro list_entry(
  field,
  item_name,
  hint='',
  autocomplete=True
) %}

  {% if error %}
    <div class="validation-wrapper">
  {% endif %}
    <fieldset class="form-group{% if field.errors %} error{% endif %}" id="{{ field.name }}">
      <legend>
        <span class="form-label">
          {{ field.label.text }}
          {% if hint %}
            <span class="form-hint">
              {{ hint }}
            </span>
          {% endif %}
          {% if field.errors %}
            <span class="error-message">
              {{ field.errors[0][0] }}
            </span>
          {% endif %}
        </label>
      </legend>
      {% if hint %}
        <span class="hint">
          {{ hint }}
        </span>
      {% endif %}
      <div class="input-list" data-module="list-entry" data-list-item-name="{{ item_name }}" id="list-entry-{{ field.name }}">
        {% for index in range(0, field.entries|length) %}
          <div class="list-entry">
            <label for="input-{{ field.name }}-{{ index }}" class="text-box-number-label">
              <span class="visuallyhidden">{{ item_name }} number </span>{{ index + 1 }}.
            </label>
            <input
              type="text"
              name="{{ field.name }}-{{ index }}"
              id="input-{{ field.name }}-{{ index }}"
              class="form-control form-control-1-1"
              value="{{ field.data[index] }}"
              {% if not autocomplete %}autocomplete="off"{% endif %}
            />
          </div>
        {% endfor %}
      </div>
    </fieldset>
  {% if error %}
    </div>
  {% endif %}

{% endmacro %}
