{% load dynamicforms %}
{% if field.display_form == DYNAMICFORMS.DisplayMode.FULL or field.display_form == DYNAMICFORMS.DisplayMode.INVISIBLE %}
<div id="container-{{ field.uuid }}"
     class="{% block container_class %}form-group{% endblock %}
            {% if field.errors %}has-error{% endif %}
            {% if style.display == 'none' or field.display_form == DYNAMICFORMS.DisplayMode.INVISIBLE%}hidden{% endif %}
           ">
  {% block field_input_label %}
    {% if field.label %}
      <label id="label-{{ field.uuid }}" for="{{ field.name }}" {% if style.hide_label %}class="sr-only"{% endif %}>
        {{ field.label }}
      </label>
    {% endif %}

    {% block field_input %}{% endblock %}
  {% endblock %}

  {% comment %}<div id="errors-{{ field.uuid }}">{% endcomment %}
  {% if field.errors %}
    {% for error in field.errors %}
      <span class="help-block">{{ error }}</span>
    {% endfor %}
  {% endif %}
  {% comment %}</div>{% endcomment %}

  {% if field.help_text_form %}
    <span id="help-{{ field.uuid }}" class="help-block">{{ field.help_text_form|safe }}</span>
  {% endif %}
</div>
<script type="application/javascript">
  {% block field_onchange %}$('#{{ field.uuid }}')
    .on('change', function () { dynamicforms.fieldChange('{{ field.uuid }}', 'final'); });
  {% endblock %}
  {% block field_get %}dynamicforms
    .registerFieldGetter('{{ style.serializer.uuid }}', '{{ field.uuid }}', dynamicforms.fieldGetValue); {% endblock %}
  {% block field_set %}dynamicforms
    .registerFieldSetter('{{ style.serializer.uuid }}', '{{ field.uuid }}', dynamicforms.fieldSetValue); {% endblock %}
  {% render_table_commands style.serializer 'onfieldinit' field_name=field.uuid %}
</script>
{% elif field.display_form == DYNAMICFORMS.DisplayMode.HIDDEN %}
  <input type="hidden" id="{{ field.uuid }}" name="{{ field.name }}" value="{{ field.value }}"/>
  <script type="application/javascript">
    dynamicforms.registerFieldGetter('{{ style.serializer.uuid }}', '{{ field.uuid }}', dynamicforms.fieldGetValue);
    dynamicforms.registerFieldSetter('{{ style.serializer.uuid }}', '{{ field.uuid }}', dynamicforms.fieldSetValue);
  </script>
{% endif %}