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.
This commit is contained in:
Flavio Copes
2015-12-22 13:48:59 +01:00
parent 011c53515e
commit 8f52ad156b

View File

@@ -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;