From 8f52ad156bb68637e3ffeac5bc7d256e1c2222ce Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Tue, 22 Dec 2015 13:48:59 +0100 Subject: [PATCH] Restore file inputs functionality. Process the form via javascript only if no file inputs are found. The file inputs are not found in Pages, so in that case, the JS form processing still kicks in as usual. In plugins and themes blueprints on the other hand, if there is a file input we avoid JS processing, since we also do not actually need this part of code in those forms. --- themes/grav/js/forms/form.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/themes/grav/js/forms/form.js b/themes/grav/js/forms/form.js index fc4855e0..d76852ab 100644 --- a/themes/grav/js/forms/form.js +++ b/themes/grav/js/forms/form.js @@ -171,9 +171,12 @@ this.form = $(el); this.form.data('grav-form-instance', this); this.form.on('submit', function (e) { - this.submit(this.ajax); - e.preventDefault(); - return false; + if (Form.findElements(this.form, 'input[type="file"]', '', false).length == 0) { + //Only process the form if it does not contain file elements, otherwise we cannot get $_FILES correctly + this.submit(this.ajax); + e.preventDefault(); + return false; + } }.bind(this)); this.scanned = false;