Files
notifications-admin/app/templates/components/list-entry.html
Chris Hill-Scott d5edb8dbfb Track form validation errors in Google analytics
We started tracking upload errors in eb264f34b7

This has been useful.

This commit adds tracking of other form validation errors, so we can
pick up if there’s a form field that’s causing people particular
trouble.

Also had to rewrite a very old test to look for page content in a
smarter way.
2017-10-16 15:26:21 +01:00

55 lines
1.7 KiB
HTML

{% macro list_entry(
field,
item_name,
hint='',
autocomplete=True
) %}
{% if error %}
<div class="validation-wrapper">
{% endif %}
<fieldset class="form-group{% if field.errors %} form-group-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" data-module="track-error" data-error-type="{{ field.errors[0][0] }}" data-error-label="{{ field.name }}">
{{ 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 %}