select.html 664 B

123456789101112131415161718
  1. <div class="form-group">
  2. <label for="{{ field_id }}">
  3. {{ label }}
  4. </label>
  5. <select class="form-control {% if error %}is-invalid{% endif %}" id="{{ field_id }}" name="{{ field_name }}">
  6. <option></option>
  7. {% for choice_value, choice_text in field.choices %}
  8. <option value="{{ choice_value }}" {% if value == choice_value %}selected{% endif %}>{{ choice_text }}</option>
  9. {% endfor %}
  10. </select>
  11. {% if error %}
  12. <small class="invalid-feedback">{{ error }}</small>
  13. {% elif field.description %}
  14. <small class="form-text text-muted">{{ field.description }}</small>
  15. {% endif %}
  16. </div>