{% set maxChars = (field.limit and field.maxType == 'characters' and field.max) ? field.max : null %}
{% set maxWords = (field.limit and field.maxType == 'words' and field.max) ? field.max : null %}
{{ fieldtag('fieldInput', {
value: value ?? false,
}) }}
{% if field.limit %}
{% if maxChars %}
{% fieldtag 'fieldLimit' with {
'data-limit': true,
'data-max-chars': maxChars,
} %}
{{- '{startTag}{num}{endTag} characters left' | t('formie', {
num: maxChars,
startTag: '',
endTag: '',
}) | raw -}}
{% endfieldtag %}
{% endif %}
{% if maxWords %}
{% fieldtag 'fieldLimit' with {
'data-limit': true,
'data-max-words': maxWords,
} %}
{{- '{startTag}{num}{endTag} words left' | t('formie', {
num: maxWords,
startTag: '',
endTag: '',
}) | raw -}}
{% endfieldtag %}
{% endif %}
{% endif %}