{% if 'choices' in schema %}
  {% include "objects/fields/text_choices_field.html" %}
{% else %}
  {% for language in input_languages %}
    <div data-sampledb-language-input-for="{{ language.lang_code }}"
      {% if input_languages | length > 1 %}style="display: none; {% if loop.index0 %}margin-top: 15px;{% endif %}"{% endif %}
      class="{% if input_languages | length > 1 %}input-group{% endif %} {% if not language.enabled_for_input %}has-error{% endif %}"
    >
      {% if schema.markdown %}
        <textarea
          style="resize: vertical; min-height: 171px;"
          class="form-control {% if is_template %} template-markdown-editor {% endif %}"
          data-markdown-textarea="true"
          name="{{ id_prefix }}_text_{{ language.lang_code }}"
          placeholder="{{ (schema.placeholder or schema.title) | get_translated_text }}"
        >
          {%- if id_prefix+'_text_' + language.lang_code in form_data -%}
            {{ form_data[id_prefix + '_text_' + language.lang_code] }}
          {%- elif data is not none and "text" in data -%}
            {{ data.text | get_translated_text(language.lang_code) }}
          {%- endif -%}
        </textarea>
      {% elif schema.multiline  %}
        <textarea
          style="resize: vertical; min-height:2.5em; height:4em;"
          class="form-control"
          name="{{ id_prefix }}_text_{{ language.lang_code }}"
          placeholder="{{ (schema.placeholder or schema.title) | get_translated_text }}"
        >
          {%- if id_prefix+'_text_' + language.lang_code in form_data -%}
            {{ form_data[id_prefix + '_text_' + language.lang_code] }}
          {%- elif data is not none and "text" in data -%}
            {{ data.text | get_translated_text(language.lang_code) }}
          {%- endif -%}
        </textarea>
      {% else %}
        <input
          type="text"
          class="form-control"
          name="{{ id_prefix }}_text_{{ language.lang_code }}"
          placeholder="{{ (schema.placeholder or schema.title) | get_translated_text  }}"
          {% if id_prefix+'_text_' + language.lang_code in form_data %}
            value="{{ form_data[id_prefix + '_text_' + language.lang_code] }}"
          {% elif data is not none and "text" in data %}
            value="{{ data.text | get_translated_text(language.lang_code) }}"
          {% endif %}
        />
      {% endif %}
      {% if input_languages | length > 1 %}
        <span class="input-group-addon language-addon">{{ language.names | get_translated_text }}</span>
      {% endif %}
    </div>
  {% endfor %}
{% endif %}
{% if disabled_input_language_codes and not (id_prefix + '_text' in errors or id_prefix + '_text_en' in errors) %}
  <div class="has-error" data-sampledb-disabled-languages-codes="{{ disabled_language_codes | join(',')}}" data-sampledb-disabled-languages-picker="{{ id_prefix }}-select-language">
    <span class="help-block"><strong>{{ _('Error:') }}</strong> {{ _('The following languages have been disabled for input:') }} {{ disabled_language_names | join(', ') }}</span>
  </div>
{% endif %}
