If a field of the form is file, add enctype attribute with multipart/form-data

This commit is contained in:
Flavio Copes
2015-12-16 10:18:36 +01:00
parent cd295a33b3
commit 370ca99620

View File

@@ -1,6 +1,13 @@
{% set form_id = form_id ? form_id : 'blueprints' %}
<form id="{{ form_id }}" method="post" data-grav-form="{{ form_id }}" data-grav-keepalive="true">
{% set multipart = '' %}
{% for field in blueprints.fields %}
{% if field.type == 'file' %}
{% set multipart = ' enctype="multipart/form-data"' %}
{% endif %}
{% endfor %}
<form id="{{ form_id }}" method="post" data-grav-form="{{ form_id }}" data-grav-keepalive="true"{{ multipart }}>
{% for field in blueprints.fields %}
{% if field.type %}
{% set value = data.value(field.name) %}